From 6fb5ab78ebaa526ec2cab7af9fbb52af466545bf Mon Sep 17 00:00:00 2001 From: Andrzej Jackowski Date: Thu, 5 Mar 2026 14:29:10 +0100 Subject: [PATCH] db/config: move guardrails config to one place and reorder The motivations for this patch are as follows: - Guardrails should follow similar conventions, e.g. for config names, metrics names, testing. Keeping guardrails together makes it easier to find and compare existing guardrails when new guardrails are implemented. - The configuration is used to auto-generate the documentation (particularly, the `configuration-parameters` page). Currently, the order of parameters in the documentation is inconsistent (e.g. `minimum_replication_factor_fail_threshold` before `minimum_replication_factor_warn_threshold` but `maximum_replication_factor_fail_threshold` after `maximum_replication_factor_warn_threshold`), which can be confusing to customers. Fixes: SCYLLADB-256 Closes scylladb/scylladb#28932 --- db/config.cc | 12 ++++++------ db/config.hh | 16 +++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/db/config.cc b/db/config.cc index 6bb9fc54d0..067d2d6de1 100644 --- a/db/config.cc +++ b/db/config.cc @@ -1539,10 +1539,15 @@ db::config::config(std::shared_ptr exts) "Ignored if authentication tables already contain a super user password.") , auth_certificate_role_queries(this, "auth_certificate_role_queries", value_status::Used, { { { "source", "SUBJECT" }, {"query", "CN=([^,]+)" } } }, "Regular expression used by CertificateAuthenticator to extract role name from an accepted transport authentication certificate subject info.") + , enable_create_table_with_compact_storage(this, "enable_create_table_with_compact_storage", liveness::LiveUpdate, value_status::Used, false, "Enable the deprecated feature of CREATE TABLE WITH COMPACT STORAGE. This feature will eventually be removed in a future version.") , minimum_replication_factor_fail_threshold(this, "minimum_replication_factor_fail_threshold", liveness::LiveUpdate, value_status::Used, -1, "") , minimum_replication_factor_warn_threshold(this, "minimum_replication_factor_warn_threshold", liveness::LiveUpdate, value_status::Used, 3, "") - , maximum_replication_factor_warn_threshold(this, "maximum_replication_factor_warn_threshold", liveness::LiveUpdate, value_status::Used, -1, "") , maximum_replication_factor_fail_threshold(this, "maximum_replication_factor_fail_threshold", liveness::LiveUpdate, value_status::Used, -1, "") + , maximum_replication_factor_warn_threshold(this, "maximum_replication_factor_warn_threshold", liveness::LiveUpdate, value_status::Used, -1, "") + , replication_strategy_fail_list(this, "replication_strategy_fail_list", liveness::LiveUpdate, value_status::Used, {}, "Controls which replication strategies are disallowed to be used when creating/altering a keyspace. Doesn't affect the pre-existing keyspaces.") + , replication_strategy_warn_list(this, "replication_strategy_warn_list", liveness::LiveUpdate, value_status::Used, {locator::replication_strategy_type::simple}, "Controls which replication strategies to warn about when creating/altering a keyspace. Doesn't affect the pre-existing keyspaces.") + , write_consistency_levels_disallowed(this, "write_consistency_levels_disallowed", liveness::LiveUpdate, value_status::Used, {}, "A list of consistency levels that are not allowed for write operations. Requests using these levels will fail.") + , write_consistency_levels_warned(this, "write_consistency_levels_warned", liveness::LiveUpdate, value_status::Used, {}, "A list of consistency levels that will trigger a warning when used in write operations. Requests using these levels will contain a warning in the query response.") , tablets_initial_scale_factor(this, "tablets_initial_scale_factor", liveness::LiveUpdate, value_status::Used, 10, "Minimum average number of tablet replicas per shard per table. Suppressed by tablet options in table's schema: min_per_shard_tablet_count and min_tablet_count") , tablets_per_shard_goal(this, "tablets_per_shard_goal", liveness::LiveUpdate, value_status::Used, 100, @@ -1555,8 +1560,6 @@ db::config::config(std::shared_ptr exts) "Maximum number of tablets which may be leaving a shard at the same time. Effecting only on topology coordinator. Set to the same value on all nodes.") , tablet_streaming_write_concurrency_per_shard(this, "tablet_streaming_write_concurrency_per_shard", liveness::LiveUpdate, value_status::Used, 2, "Maximum number of tablets which may be pending on a shard at the same time. Effecting only on topology coordinator. Set to the same value on all nodes.") - , replication_strategy_warn_list(this, "replication_strategy_warn_list", liveness::LiveUpdate, value_status::Used, {locator::replication_strategy_type::simple}, "Controls which replication strategies to warn about when creating/altering a keyspace. Doesn't affect the pre-existing keyspaces.") - , replication_strategy_fail_list(this, "replication_strategy_fail_list", liveness::LiveUpdate, value_status::Used, {}, "Controls which replication strategies are disallowed to be used when creating/altering a keyspace. Doesn't affect the pre-existing keyspaces.") , service_levels_interval(this, "service_levels_interval_ms", liveness::LiveUpdate, value_status::Used, 10000, "Controls how often service levels module polls configuration table") , audit(this, "audit", value_status::Used, "table", @@ -1594,7 +1597,6 @@ db::config::config(std::shared_ptr exts) , disk_space_monitor_high_polling_interval_in_seconds(this, "disk_space_monitor_high_polling_interval_in_seconds", value_status::Used, 1, "Disk-space polling interval at or above polling threshold") , disk_space_monitor_polling_interval_threshold(this, "disk_space_monitor_polling_interval_threshold", value_status::Used, 0.9, "Disk-space polling threshold. Polling interval is increased when disk utilization is greater than or equal to this threshold") , critical_disk_utilization_level(this, "critical_disk_utilization_level", liveness::LiveUpdate, value_status::Used, 0.98, "Disk utilization level above which mechanisms preventing a node getting out of space are activated") - , enable_create_table_with_compact_storage(this, "enable_create_table_with_compact_storage", liveness::LiveUpdate, value_status::Used, false, "Enable the deprecated feature of CREATE TABLE WITH COMPACT STORAGE. This feature will eventually be removed in a future version.") , rf_rack_valid_keyspaces(this, "rf_rack_valid_keyspaces", liveness::MustRestart, value_status::Used, false, "Enforce RF-rack-valid keyspaces. Additionally, if there are existing RF-rack-invalid " "keyspaces, attempting to start a node with this option ON will fail. " @@ -1634,8 +1636,6 @@ db::config::config(std::shared_ptr exts) "Set the minimum interval in seconds between flushing all tables before each major compaction (default is 86400)." "This option is useful for maximizing tombstone garbage collection by releasing all active commitlog segments." "Set to 0 to disable automatic flushing all tables before major compaction.") - , write_consistency_levels_warned(this, "write_consistency_levels_warned", liveness::LiveUpdate, value_status::Used, {}, "A list of consistency levels that will trigger a warning when used in write operations. Requests using these levels will contain a warning in the query response.") - , write_consistency_levels_disallowed(this, "write_consistency_levels_disallowed", liveness::LiveUpdate, value_status::Used, {}, "A list of consistency levels that are not allowed for write operations. Requests using these levels will fail.") , default_log_level(this, "default_log_level", value_status::Used, seastar::log_level::info, "Default log level for log messages") , logger_log_level(this, "logger_log_level", value_status::Used, {}, "Map of logger name to log level. Valid log levels are 'error', 'warn', 'info', 'debug' and 'trace'") , log_to_stdout(this, "log_to_stdout", value_status::Used, true, "Send log output to stdout") diff --git a/db/config.hh b/db/config.hh index e0048388e7..6b718fb617 100644 --- a/db/config.hh +++ b/db/config.hh @@ -539,10 +539,16 @@ public: named_value>> auth_certificate_role_queries; + // guardrails options + named_value enable_create_table_with_compact_storage; named_value minimum_replication_factor_fail_threshold; named_value minimum_replication_factor_warn_threshold; - named_value maximum_replication_factor_warn_threshold; named_value maximum_replication_factor_fail_threshold; + named_value maximum_replication_factor_warn_threshold; + named_value>> replication_strategy_fail_list; + named_value>> replication_strategy_warn_list; + named_value>> write_consistency_levels_disallowed; + named_value>> write_consistency_levels_warned; named_value tablets_initial_scale_factor; named_value tablets_per_shard_goal; @@ -550,9 +556,6 @@ public: named_value tablet_streaming_read_concurrency_per_shard; named_value tablet_streaming_write_concurrency_per_shard; - named_value>> replication_strategy_warn_list; - named_value>> replication_strategy_fail_list; - named_value service_levels_interval; named_value audit; @@ -603,8 +606,6 @@ public: named_value disk_space_monitor_polling_interval_threshold; named_value critical_disk_utilization_level; - named_value enable_create_table_with_compact_storage; - named_value rf_rack_valid_keyspaces; named_value enforce_rack_list; @@ -621,9 +622,6 @@ public: named_value compaction_enforce_min_threshold; named_value compaction_flush_all_tables_before_major_seconds; - named_value>> write_consistency_levels_warned; - named_value>> write_consistency_levels_disallowed; - static const sstring default_tls_priority; private: template