features: add MD_SSTABLE_FORMAT cluster feature

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2020-07-27 20:52:10 +03:00
parent 65239a6e50
commit e8d7744040
6 changed files with 19 additions and 2 deletions

View File

@@ -45,8 +45,9 @@ sstables_format_selector::sstables_format_selector(gms::gossiper& g, sharded<gms
: _gossiper(g)
, _features(f)
, _db(db)
, _mc_feature_listener(*this, sstables::sstable_version_types::mc) {
}
, _mc_feature_listener(*this, sstables::sstable_version_types::mc)
, _md_feature_listener(*this, sstables::sstable_version_types::md)
{ }
future<> sstables_format_selector::maybe_select_format(sstables::sstable_version_types new_format) {
return with_gate(_sel, [this, new_format] {
@@ -75,6 +76,7 @@ future<> sstables_format_selector::start() {
assert(this_shard_id() == 0);
return read_sstables_format().then([this] {
_features.local().cluster_supports_mc_sstable().when_enabled(_mc_feature_listener);
_features.local().cluster_supports_md_sstable().when_enabled(_md_feature_listener);
return make_ready_future<>();
});
}

View File

@@ -62,6 +62,7 @@ class sstables_format_selector {
seastar::gate _sel;
feature_enabled_listener _mc_feature_listener;
feature_enabled_listener _md_feature_listener;
sstables::sstable_version_types _selected_format = sstables::sstable_version_types::la;
future<> select_format(sstables::sstable_version_types new_format);

View File

@@ -128,6 +128,7 @@ extern const std::string_view ROLES;
extern const std::string_view LA_SSTABLE;
extern const std::string_view STREAM_WITH_RPC_STREAM;
extern const std::string_view MC_SSTABLE;
extern const std::string_view MD_SSTABLE;
extern const std::string_view ROW_LEVEL_REPAIR;
extern const std::string_view TRUNCATION_TABLE;
extern const std::string_view CORRECT_STATIC_COMPACT_IN_MC;

View File

@@ -43,6 +43,7 @@ constexpr std::string_view features::ROLES = "ROLES";
constexpr std::string_view features::LA_SSTABLE = "LA_SSTABLE_FORMAT";
constexpr std::string_view features::STREAM_WITH_RPC_STREAM = "STREAM_WITH_RPC_STREAM";
constexpr std::string_view features::MC_SSTABLE = "MC_SSTABLE_FORMAT";
constexpr std::string_view features::MD_SSTABLE = "MD_SSTABLE_FORMAT";
constexpr std::string_view features::ROW_LEVEL_REPAIR = "ROW_LEVEL_REPAIR";
constexpr std::string_view features::TRUNCATION_TABLE = "TRUNCATION_TABLE";
constexpr std::string_view features::CORRECT_STATIC_COMPACT_IN_MC = "CORRECT_STATIC_COMPACT_IN_MC";
@@ -78,6 +79,7 @@ feature_service::feature_service(feature_config cfg) : _config(cfg)
, _roles_feature(*this, features::ROLES)
, _stream_with_rpc_stream_feature(*this, features::STREAM_WITH_RPC_STREAM)
, _mc_sstable_feature(*this, features::MC_SSTABLE)
, _md_sstable_feature(*this, features::MD_SSTABLE)
, _row_level_repair_feature(*this, features::ROW_LEVEL_REPAIR)
, _truncation_table(*this, features::TRUNCATION_TABLE)
, _correct_static_compact_in_mc(*this, features::CORRECT_STATIC_COMPACT_IN_MC)
@@ -108,6 +110,9 @@ feature_config feature_config_from_db_config(db::config& cfg, std::set<sstring>
}
fcfg._disabled_features.insert(sstring(gms::features::MC_SSTABLE));
}
if (!cfg.enable_sstables_md_format()) {
fcfg._disabled_features.insert(sstring(gms::features::MD_SSTABLE));
}
if (!cfg.enable_user_defined_functions()) {
fcfg._disabled_features.insert(sstring(gms::features::UDF));
} else {
@@ -182,6 +187,7 @@ std::set<std::string_view> feature_service::known_feature_set() {
gms::features::PER_TABLE_CACHING,
gms::features::LWT,
gms::features::MC_SSTABLE,
gms::features::MD_SSTABLE,
gms::features::UDF,
gms::features::CDC,
};
@@ -261,6 +267,7 @@ void feature_service::enable(const std::set<std::string_view>& list) {
std::ref(_roles_feature),
std::ref(_stream_with_rpc_stream_feature),
std::ref(_mc_sstable_feature),
std::ref(_md_sstable_feature),
std::ref(_row_level_repair_feature),
std::ref(_truncation_table),
std::ref(_correct_static_compact_in_mc),

View File

@@ -90,6 +90,7 @@ private:
gms::feature _roles_feature;
gms::feature _stream_with_rpc_stream_feature;
gms::feature _mc_sstable_feature;
gms::feature _md_sstable_feature;
gms::feature _row_level_repair_feature;
gms::feature _truncation_table;
gms::feature _correct_static_compact_in_mc;
@@ -165,6 +166,10 @@ public:
return _mc_sstable_feature;
}
const feature& cluster_supports_md_sstable() const {
return _md_sstable_feature;
}
const feature& cluster_supports_cdc() const {
return _cdc_feature;
}

View File

@@ -3697,6 +3697,7 @@ class scylla_features(gdb.Command):
"ROLES": true
"LA_SSTABLE_FORMAT": true
"MC_SSTABLE_FORMAT": true
"MD_SSTABLE_FORMAT": true
"STREAM_WITH_RPC_STREAM": true
"ROW_LEVEL_REPAIR": true
"TRUNCATION_TABLE": true