Interface GuardrailsConfig

  • All Known Implementing Classes:
    GuardrailsOptions

    public interface GuardrailsConfig
    Configuration settings for guardrails.

    Note that the settings here must only be used by the Guardrails class and not directly by the code checking each guarded constraint (which, again, should use the higher level abstractions defined in Guardrails).

    We have 2 variants of guardrails, soft (warn) and hard (fail) limits, each guardrail having either one of the variants or both. Note in particular that hard limits only make sense for guardrails triggering during query execution. For other guardrails, say one triggering during compaction, aborting that compaction does not make sense.

    Additionally, each individual setting should have a specific value (typically -1 for numeric settings), that allows to disable the corresponding guardrail.

    This configuration is offered as an interface so different implementations of GuardrailsConfigProvider can provide different implementations of this config. However, this mechanism for guardrails config pluggability is not officially supported and this interface may change in a minor release.

    • Method Detail

      • getKeyspacesWarnThreshold

        int getKeyspacesWarnThreshold()
        Returns:
        The threshold to warn when creating more user keyspaces than threshold.
      • getKeyspacesFailThreshold

        int getKeyspacesFailThreshold()
        Returns:
        The threshold to fail when creating more user keyspaces than threshold.
      • getTablesWarnThreshold

        int getTablesWarnThreshold()
        Returns:
        The threshold to warn when creating more user tables than threshold.
      • getTablesFailThreshold

        int getTablesFailThreshold()
        Returns:
        The threshold to fail when creating more user tables than threshold.
      • getColumnsPerTableWarnThreshold

        int getColumnsPerTableWarnThreshold()
        Returns:
        The threshold to warn when creating more columns per table than threshold.
      • getColumnsPerTableFailThreshold

        int getColumnsPerTableFailThreshold()
        Returns:
        The threshold to fail when creating more columns per table than threshold.
      • getSecondaryIndexesPerTableWarnThreshold

        int getSecondaryIndexesPerTableWarnThreshold()
        Returns:
        The threshold to warn when creating more secondary indexes per table than threshold.
      • getSecondaryIndexesPerTableFailThreshold

        int getSecondaryIndexesPerTableFailThreshold()
        Returns:
        The threshold to fail when creating more secondary indexes per table than threshold.
      • getSecondaryIndexesEnabled

        boolean getSecondaryIndexesEnabled()
        Returns:
        Whether creation of secondary indexes is allowed.
      • getMaterializedViewsPerTableWarnThreshold

        int getMaterializedViewsPerTableWarnThreshold()
        Returns:
        The threshold to warn when creating more materialized views per table than threshold.
      • getPartitionKeysInSelectWarnThreshold

        int getPartitionKeysInSelectWarnThreshold()
        Returns:
        The threshold to warn when partition keys in select more than threshold.
      • getPartitionKeysInSelectFailThreshold

        int getPartitionKeysInSelectFailThreshold()
        Returns:
        The threshold to fail when partition keys in select more than threshold.
      • getMaterializedViewsPerTableFailThreshold

        int getMaterializedViewsPerTableFailThreshold()
        Returns:
        The threshold to fail when creating more materialized views per table than threshold.
      • getTablePropertiesWarned

        java.util.Set<java.lang.String> getTablePropertiesWarned()
        Returns:
        The table properties that are warned about when creating or altering a table.
      • getTablePropertiesIgnored

        java.util.Set<java.lang.String> getTablePropertiesIgnored()
        Returns:
        The table properties that are ignored when creating or altering a table.
      • getTablePropertiesDisallowed

        java.util.Set<java.lang.String> getTablePropertiesDisallowed()
        Returns:
        The table properties that are disallowed when creating or altering a table.
      • getUserTimestampsEnabled

        boolean getUserTimestampsEnabled()
        Returns whether user-provided timestamps are allowed.
        Returns:
        true if user-provided timestamps are allowed, false otherwise.
      • getAlterTableEnabled

        boolean getAlterTableEnabled()
        Returns whether users are allowed access to the ALTER TABLE statement to mutate columns or not
        Returns:
        true if ALTER TABLE ADD/REMOVE/RENAME is allowed, false otherwise.
      • getUncompressedTablesEnabled

        boolean getUncompressedTablesEnabled()
        Returns whether tables can be uncompressed
        Returns:
        true if user's can disable compression, false otherwise.
      • getCompactTablesEnabled

        boolean getCompactTablesEnabled()
        Returns whether users can create new COMPACT STORAGE tables
        Returns:
        true if allowed, false otherwise.
      • getGroupByEnabled

        boolean getGroupByEnabled()
        Returns whether GROUP BY functionality is allowed
        Returns:
        true if allowed, false otherwise.
      • getDropTruncateTableEnabled

        boolean getDropTruncateTableEnabled()
        Returns whether TRUNCATE or DROP table are allowed
        Returns:
        true if allowed, false otherwise.
      • getDropKeyspaceEnabled

        boolean getDropKeyspaceEnabled()
        Returns whether DROP on keyspaces is allowed
        Returns:
        true if allowed, false otherwise.
      • getPageSizeWarnThreshold

        int getPageSizeWarnThreshold()
        Returns:
        The threshold to warn when page size exceeds given size.
      • getPageSizeFailThreshold

        int getPageSizeFailThreshold()
        Returns:
        The threshold to fail when page size exceeds given size.
      • getReadBeforeWriteListOperationsEnabled

        boolean getReadBeforeWriteListOperationsEnabled()
        Returns whether list operations that require read before write are allowed.
        Returns:
        true if list operations that require read before write are allowed, false otherwise.
      • getAllowFilteringEnabled

        boolean getAllowFilteringEnabled()
        Returns whether ALLOW FILTERING property is allowed.
        Returns:
        true if ALLOW FILTERING is allowed, false otherwise.
      • getSimpleStrategyEnabled

        boolean getSimpleStrategyEnabled()
        Returns whether setting SimpleStrategy via keyspace creation or alteration is enabled
        Returns:
        true if SimpleStrategy is allowed, false otherwise.
      • getInSelectCartesianProductWarnThreshold

        int getInSelectCartesianProductWarnThreshold()
        Returns:
        The threshold to warn when an IN query creates a cartesian product with a size exceeding threshold. -1 means disabled.
      • getInSelectCartesianProductFailThreshold

        int getInSelectCartesianProductFailThreshold()
        Returns:
        The threshold to prevent IN queries creating a cartesian product with a size exceeding threshold. -1 means disabled.
      • getReadConsistencyLevelsWarned

        java.util.Set<ConsistencyLevel> getReadConsistencyLevelsWarned()
        Returns:
        The consistency levels that are warned about when reading.
      • getReadConsistencyLevelsDisallowed

        java.util.Set<ConsistencyLevel> getReadConsistencyLevelsDisallowed()
        Returns:
        The consistency levels that are disallowed when reading.
      • getWriteConsistencyLevelsWarned

        java.util.Set<ConsistencyLevel> getWriteConsistencyLevelsWarned()
        Returns:
        The consistency levels that are warned about when writing.
      • getWriteConsistencyLevelsDisallowed

        java.util.Set<ConsistencyLevel> getWriteConsistencyLevelsDisallowed()
        Returns:
        The consistency levels that are disallowed when writing.
      • getPartitionSizeWarnThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getPartitionSizeWarnThreshold()
        Returns:
        The threshold to warn when writing partitions larger than threshold.
      • getPartitionSizeFailThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getPartitionSizeFailThreshold()
        Returns:
        The threshold to fail when writing partitions larger than threshold.
      • getPartitionTombstonesWarnThreshold

        long getPartitionTombstonesWarnThreshold()
        Returns:
        The threshold to warn when writing partitions with more tombstones than threshold.
      • getPartitionTombstonesFailThreshold

        long getPartitionTombstonesFailThreshold()
        Returns:
        The threshold to fail when writing partitions with more tombstones than threshold.
      • getColumnValueSizeWarnThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getColumnValueSizeWarnThreshold()
        Returns:
        The threshold to warn when writing column values larger than threshold.
      • getColumnValueSizeFailThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getColumnValueSizeFailThreshold()
        Returns:
        The threshold to prevent writing column values larger than threshold.
      • getCollectionSizeWarnThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getCollectionSizeWarnThreshold()
        Returns:
        The threshold to warn when encountering a collection with larger data size than threshold.
      • getCollectionSizeFailThreshold

        @Nullable
        DataStorageSpec.LongBytesBound getCollectionSizeFailThreshold()
        Returns:
        The threshold to prevent collections with larger data size than threshold.
      • getItemsPerCollectionWarnThreshold

        int getItemsPerCollectionWarnThreshold()
        Returns:
        The threshold to warn when encountering more elements in a collection than threshold.
      • getItemsPerCollectionFailThreshold

        int getItemsPerCollectionFailThreshold()
        Returns:
        The threshold to prevent collections with more elements than threshold.
      • getFieldsPerUDTWarnThreshold

        int getFieldsPerUDTWarnThreshold()
        Returns:
        The threshold to warn when creating a UDT with more fields than threshold.
      • getFieldsPerUDTFailThreshold

        int getFieldsPerUDTFailThreshold()
        Returns:
        The threshold to fail when creating a UDT with more fields than threshold.
      • getVectorDimensionsWarnThreshold

        int getVectorDimensionsWarnThreshold()
        Returns:
        The threshold to warn when creating a vector with more dimensions than threshold.
      • getVectorDimensionsFailThreshold

        int getVectorDimensionsFailThreshold()
        Returns:
        The threshold to fail when creating a vector with more dimensions than threshold.
      • getDataDiskUsagePercentageWarnThreshold

        int getDataDiskUsagePercentageWarnThreshold()
        Returns:
        The threshold to warn when local disk usage percentage exceeds that threshold. Allowed values are in the range [1, 100], and -1 means disabled.
      • getDataDiskUsagePercentageFailThreshold

        int getDataDiskUsagePercentageFailThreshold()
        Returns:
        The threshold to fail when local disk usage percentage exceeds that threshold. Allowed values are in the range [1, 100], and -1 means disabled.
      • getDataDiskUsageMaxDiskSize

        @Nullable
        DataStorageSpec.LongBytesBound getDataDiskUsageMaxDiskSize()
        Returns:
        The max disk size of the data directories when calculating disk usage thresholds, null means disabled.
      • getMinimumReplicationFactorWarnThreshold

        int getMinimumReplicationFactorWarnThreshold()
        Returns:
        The threshold to warn when replication factor is lesser than threshold.
      • getMinimumReplicationFactorFailThreshold

        int getMinimumReplicationFactorFailThreshold()
        Returns:
        The threshold to fail when replication factor is lesser than threshold.
      • getMaximumReplicationFactorWarnThreshold

        int getMaximumReplicationFactorWarnThreshold()
        Returns:
        The threshold to warn when replication factor is greater than threshold.
      • getMaximumReplicationFactorFailThreshold

        int getMaximumReplicationFactorFailThreshold()
        Returns:
        The threshold to fail when replication factor is greater than threshold.
      • getZeroTTLOnTWCSWarned

        boolean getZeroTTLOnTWCSWarned()
        Returns whether warnings will be emitted when usage of 0 default TTL on a table with TimeWindowCompactionStrategy is detected.
        Returns:
        true if warnings will be emitted, false otherwise.
      • setZeroTTLOnTWCSWarned

        void setZeroTTLOnTWCSWarned​(boolean value)
        Sets whether warnings will be emitted when usage of 0 default TTL on a table with TimeWindowCompactionStrategy is detected.
        Parameters:
        value - true if warning will be emitted, false otherwise.
      • getZeroTTLOnTWCSEnabled

        boolean getZeroTTLOnTWCSEnabled()
        Returns whether it is allowed to create or alter table to use 0 default TTL with TimeWindowCompactionStrategy. If it is not, such query will fail.
        Returns:
        true if 0 default TTL is allowed on TWCS table, false otherwise.
      • setZeroTTLOnTWCSEnabled

        void setZeroTTLOnTWCSEnabled​(boolean value)
        Sets whether users can use 0 default TTL on a table with TimeWindowCompactionStrategy.
        Parameters:
        value - true if 0 default TTL on TWCS tables is allowed, false otherwise.
      • getIntersectFilteringQueryWarned

        boolean getIntersectFilteringQueryWarned()
        Returns:
        true if a client warning is emitted for a filtering query with an intersection on mutable columns at a consistency level requiring coordinator reconciliation
      • setIntersectFilteringQueryWarned

        void setIntersectFilteringQueryWarned​(boolean value)
      • getIntersectFilteringQueryEnabled

        boolean getIntersectFilteringQueryEnabled()
        Returns:
        true if it is possible to execute a filtering query with an intersection on mutable columns at a consistency level requiring coordinator reconciliation
      • setIntersectFilteringQueryEnabled

        void setIntersectFilteringQueryEnabled​(boolean value)
      • getMaximumTimestampWarnThreshold

        @Nullable
        DurationSpec.LongMicrosecondsBound getMaximumTimestampWarnThreshold()
        Returns:
        A timestamp that if a user supplied timestamp is after will trigger a warning
      • getMaximumTimestampFailThreshold

        @Nullable
        DurationSpec.LongMicrosecondsBound getMaximumTimestampFailThreshold()
        Returns:
        A timestamp that if a user supplied timestamp is after will cause a failure
      • setMaximumTimestampThreshold

        void setMaximumTimestampThreshold​(@Nullable
                                          DurationSpec.LongMicrosecondsBound warn,
                                          @Nullable
                                          DurationSpec.LongMicrosecondsBound fail)
        Sets the warning upper bound for user supplied timestamps
        Parameters:
        warn - The highest acceptable difference between now and the written value timestamp before triggering a warning. null means disabled.
        fail - The highest acceptable difference between now and the written value timestamp before triggering a failure. null means disabled.
      • getMinimumTimestampWarnThreshold

        @Nullable
        DurationSpec.LongMicrosecondsBound getMinimumTimestampWarnThreshold()
        Returns:
        A timestamp that if a user supplied timestamp is before will trigger a warning
      • getMinimumTimestampFailThreshold

        @Nullable
        DurationSpec.LongMicrosecondsBound getMinimumTimestampFailThreshold()
        Returns:
        A timestamp that if a user supplied timestamp is after will trigger a warning
      • setMinimumTimestampThreshold

        void setMinimumTimestampThreshold​(@Nullable
                                          DurationSpec.LongMicrosecondsBound warn,
                                          @Nullable
                                          DurationSpec.LongMicrosecondsBound fail)
        Sets the warning lower bound for user supplied timestamps
        Parameters:
        warn - The lowest acceptable difference between now and the written value timestamp before triggering a warning. null means disabled.
        fail - The lowest acceptable difference between now and the written value timestamp before triggering a failure. null means disabled.
      • getSaiSSTableIndexesPerQueryWarnThreshold

        int getSaiSSTableIndexesPerQueryWarnThreshold()
        Returns:
        the warning threshold for the number of SAI SSTable indexes searched by a query
      • getSaiSSTableIndexesPerQueryFailThreshold

        int getSaiSSTableIndexesPerQueryFailThreshold()
        Returns:
        the failure threshold for the number of SAI SSTable indexes searched by a query
      • setSaiSSTableIndexesPerQueryThreshold

        void setSaiSSTableIndexesPerQueryThreshold​(int warn,
                                                   int fail)
        Sets warning and failure thresholds for the number of SAI SSTable indexes searched by a query
        Parameters:
        warn - value to set for warn threshold
        fail - value to set for fail threshold
      • getSaiStringTermSizeWarnThreshold

        DataStorageSpec.LongBytesBound getSaiStringTermSizeWarnThreshold()
        Returns:
        the warning threshold for the size of string terms written to an SAI index
      • getSaiStringTermSizeFailThreshold

        DataStorageSpec.LongBytesBound getSaiStringTermSizeFailThreshold()
        Returns:
        the failure threshold for the size of string terms written to an SAI index
      • setSaiStringTermSizeThreshold

        void setSaiStringTermSizeThreshold​(@Nullable
                                           DataStorageSpec.LongBytesBound warn,
                                           @Nullable
                                           DataStorageSpec.LongBytesBound fail)
        Sets warning and failure thresholds for the size of string terms written to an SAI index
        Parameters:
        warn - value to set for warn threshold
        fail - value to set for fail threshold
      • getSaiFrozenTermSizeWarnThreshold

        DataStorageSpec.LongBytesBound getSaiFrozenTermSizeWarnThreshold()
        Returns:
        the warning threshold for the size of frozen terms written to an SAI index
      • getSaiFrozenTermSizeFailThreshold

        DataStorageSpec.LongBytesBound getSaiFrozenTermSizeFailThreshold()
        Returns:
        the failure threshold for the size of frozen terms written to an SAI index
      • setSaiFrozenTermSizeThreshold

        void setSaiFrozenTermSizeThreshold​(@Nullable
                                           DataStorageSpec.LongBytesBound warn,
                                           @Nullable
                                           DataStorageSpec.LongBytesBound fail)
        Sets warning and failure thresholds for the size of frozen terms written to an SAI index
        Parameters:
        warn - value to set for warn threshold
        fail - value to set for fail threshold
      • getSaiVectorTermSizeWarnThreshold

        DataStorageSpec.LongBytesBound getSaiVectorTermSizeWarnThreshold()
        Returns:
        the warning threshold for the size of vector terms written to an SAI index
      • getSaiVectorTermSizeFailThreshold

        DataStorageSpec.LongBytesBound getSaiVectorTermSizeFailThreshold()
        Returns:
        the failure threshold for the size of vector terms written to an SAI index
      • setSaiVectorTermSizeThreshold

        void setSaiVectorTermSizeThreshold​(@Nullable
                                           DataStorageSpec.LongBytesBound warn,
                                           @Nullable
                                           DataStorageSpec.LongBytesBound fail)
        Sets warning and failure thresholds for the size of vector terms written to an SAI index
        Parameters:
        warn - value to set for warn threshold
        fail - value to set for fail threshold
      • getNonPartitionRestrictedQueryEnabled

        boolean getNonPartitionRestrictedQueryEnabled()
        Returns whether it is possible to execute a query against secondary indexes without specifying any partition key restrictions.
        Returns:
        true if it is possible to execute a query without a partition key, false otherwise
      • setNonPartitionRestrictedQueryEnabled

        void setNonPartitionRestrictedQueryEnabled​(boolean enabled)
        Sets whether it is possible to execute a query against indexes (secondary or SAI) without specifying any partition key restrictions.
        Parameters:
        enabled - true if a query without partition key is enabled or not