diff --git a/db/schema_features.hh b/db/schema_features.hh index 2ca4fd768e..b178261b4c 100644 --- a/db/schema_features.hh +++ b/db/schema_features.hh @@ -28,6 +28,9 @@ enum class schema_feature { // When enabled, schema_mutations::digest() will skip empty mutations (with only tombstones), // so that the digest remains the same after schema tables are compacted. TABLE_DIGEST_INSENSITIVE_TO_EXPIRY, + + // When enabled we'll add a new column to the `system_schema.scylla_tables` table. + GROUP0_SCHEMA_VERSIONING, }; using schema_features = enum_set>; } diff --git a/gms/feature_service.cc b/gms/feature_service.cc index feb4d1fcf8..af51156725 100644 --- a/gms/feature_service.cc +++ b/gms/feature_service.cc @@ -76,6 +76,8 @@ feature_config feature_config_from_db_config(const db::config& cfg, std::set(keyspace_storage_options); f.set_if(aggregate_storage_options); f.set_if(table_digest_insensitive_to_expiry); + f.set_if(group0_schema_versioning); return f; } diff --git a/gms/feature_service.hh b/gms/feature_service.hh index 03c4823d47..abc5e441bd 100644 --- a/gms/feature_service.hh +++ b/gms/feature_service.hh @@ -129,6 +129,14 @@ public: gms::feature tablets { *this, "TABLETS"sv }; gms::feature uuid_sstable_identifiers { *this, "UUID_SSTABLE_IDENTIFIERS"sv }; gms::feature table_digest_insensitive_to_expiry { *this, "TABLE_DIGEST_INSENSITIVE_TO_EXPIRY"sv }; + // If this feature is enabled, schema versions are persisted by the group 0 command + // that modifies schema instead of being calculated as a digest (hash) by each node separately. + // The feature controls both the 'global' schema version (the one gossiped as application_state::SCHEMA) + // and the per-table schema versions (schema::version()). + // The feature affects non-Raft mode as well (e.g. during RECOVERY), where we send additional + // tombstones and flags to schema tables when performing schema changes, allowing us to + // revert to the digest method when necessary (if we must perform a schema change during RECOVERY). + gms::feature group0_schema_versioning { *this, "GROUP0_SCHEMA_VERSIONING"sv }; // A feature just for use in tests. It must not be advertised unless // the "features_enable_test_feature" injection is enabled.