add "ME_SSTABLE" cluster feature

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
This commit is contained in:
Michael Livshin
2022-01-31 19:54:56 +02:00
parent 0b1447c702
commit d370558279
5 changed files with 16 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ sstables_format_selector::sstables_format_selector(gms::gossiper& g, sharded<gms
, _features(f)
, _db(db)
, _md_feature_listener(*this, sstables::sstable_version_types::md)
, _me_feature_listener(*this, sstables::sstable_version_types::me)
{ }
future<> sstables_format_selector::maybe_select_format(sstables::sstable_version_types new_format) {
@@ -61,6 +62,7 @@ future<> sstables_format_selector::do_maybe_select_format(sstables::sstable_vers
future<> sstables_format_selector::start() {
assert(this_shard_id() == 0);
return read_sstables_format().then([this] {
_features.local().cluster_supports_me_sstable().when_enabled(_me_feature_listener);
_features.local().cluster_supports_md_sstable().when_enabled(_md_feature_listener);
return make_ready_future<>();
});

View File

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

View File

@@ -115,6 +115,7 @@ 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 ME_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

@@ -44,6 +44,7 @@ constexpr std::string_view features::MC_SSTABLE = "MC_SSTABLE_FORMAT";
// Up-to-date features
constexpr std::string_view features::UDF = "UDF";
constexpr std::string_view features::MD_SSTABLE = "MD_SSTABLE_FORMAT";
constexpr std::string_view features::ME_SSTABLE = "ME_SSTABLE_FORMAT";
constexpr std::string_view features::VIEW_VIRTUAL_COLUMNS = "VIEW_VIRTUAL_COLUMNS";
constexpr std::string_view features::DIGEST_INSENSITIVE_TO_EXPIRY = "DIGEST_INSENSITIVE_TO_EXPIRY";
constexpr std::string_view features::COMPUTED_COLUMNS = "COMPUTED_COLUMNS";
@@ -74,6 +75,7 @@ feature_config::feature_config() {
feature_service::feature_service(feature_config cfg) : _config(cfg)
, _udf_feature(*this, features::UDF)
, _md_sstable_feature(*this, features::MD_SSTABLE)
, _me_sstable_feature(*this, features::ME_SSTABLE)
, _view_virtual_columns(*this, features::VIEW_VIRTUAL_COLUMNS)
, _digest_insensitive_to_expiry(*this, features::DIGEST_INSENSITIVE_TO_EXPIRY)
, _computed_columns(*this, features::COMPUTED_COLUMNS)
@@ -115,9 +117,12 @@ feature_config feature_config_from_db_config(db::config& cfg, std::set<sstring>
fcfg._disabled_features.insert(sstring(gms::features::MD_SSTABLE));
[[fallthrough]];
case sstables::sstable_version_types::md:
fcfg._disabled_features.insert(sstring(gms::features::ME_SSTABLE));
[[fallthrough]];
case sstables::sstable_version_types::me:
break;
}
if (!cfg.enable_user_defined_functions()) {
fcfg._disabled_features.insert(sstring(gms::features::UDF));
} else {
@@ -213,6 +218,7 @@ std::set<std::string_view> feature_service::known_feature_set() {
gms::features::PER_TABLE_CACHING,
gms::features::LWT,
gms::features::MD_SSTABLE,
gms::features::ME_SSTABLE,
gms::features::UDF,
gms::features::CDC,
gms::features::DIGEST_FOR_NULL_VALUES,
@@ -316,6 +322,7 @@ void feature_service::enable(const std::set<std::string_view>& list) {
for (gms::feature& f : {
std::ref(_udf_feature),
std::ref(_md_sstable_feature),
std::ref(_me_sstable_feature),
std::ref(_view_virtual_columns),
std::ref(_digest_insensitive_to_expiry),
std::ref(_computed_columns),

View File

@@ -71,6 +71,7 @@ public:
private:
gms::feature _udf_feature;
gms::feature _md_sstable_feature;
gms::feature _me_sstable_feature;
gms::feature _view_virtual_columns;
gms::feature _digest_insensitive_to_expiry;
gms::feature _computed_columns;
@@ -107,6 +108,10 @@ public:
return _md_sstable_feature;
}
const feature& cluster_supports_me_sstable() const {
return _me_sstable_feature;
}
const feature& cluster_supports_cdc() const {
return _cdc_feature;
}