storage_service: Introduce the CORRECT_STATIC_COMPACT feature flag

When enabled on all nodes, sstable writers will start to produce
correct MC-format sstables for compact storage tables by writing rows
into the static row (like C*) rather than into the regular row.

We only do that when all nodes are upgraded to support rolling
downgrade. After all nodes are upgraded, regular rolling downgrade will
not be possible.

Refs #4139
This commit is contained in:
Tomasz Grabiec
2019-03-05 19:08:07 +01:00
parent 52d634025d
commit fefef7b9eb
2 changed files with 8 additions and 0 deletions

View File

@@ -107,6 +107,7 @@ static const sstring STREAM_WITH_RPC_STREAM = "STREAM_WITH_RPC_STREAM";
static const sstring MC_SSTABLE_FEATURE = "MC_SSTABLE_FORMAT";
static const sstring ROW_LEVEL_REPAIR = "ROW_LEVEL_REPAIR";
static const sstring TRUNCATION_TABLE = "TRUNCATION_TABLE";
static const sstring CORRECT_STATIC_COMPACT_IN_MC = "CORRECT_STATIC_COMPACT_IN_MC";
distributed<storage_service> _the_storage_service;
@@ -153,6 +154,7 @@ storage_service::storage_service(distributed<database>& db, sharded<auth::servic
, _mc_sstable_feature(_feature_service, MC_SSTABLE_FEATURE)
, _row_level_repair_feature(_feature_service, ROW_LEVEL_REPAIR)
, _truncation_table(_feature_service, TRUNCATION_TABLE)
, _correct_static_compact_in_mc(_feature_service, CORRECT_STATIC_COMPACT_IN_MC)
, _replicate_action([this] { return do_replicate_to_all_cores(); })
, _update_pending_ranges_action([this] { return do_update_pending_ranges(); })
, _sys_dist_ks(sys_dist_ks)
@@ -185,6 +187,7 @@ void storage_service::enable_all_features() {
std::ref(_mc_sstable_feature),
std::ref(_row_level_repair_feature),
std::ref(_truncation_table),
std::ref(_correct_static_compact_in_mc),
})
{
if (features.count(f.name())) {
@@ -273,6 +276,7 @@ std::set<sstring> storage_service::get_config_supported_features_set() {
INDEXES_FEATURE,
ROW_LEVEL_REPAIR,
TRUNCATION_TABLE,
CORRECT_STATIC_COMPACT_IN_MC,
};
// Do not respect config in the case database is not started

View File

@@ -301,6 +301,7 @@ private:
gms::feature _mc_sstable_feature;
gms::feature _row_level_repair_feature;
gms::feature _truncation_table;
gms::feature _correct_static_compact_in_mc;
public:
void enable_all_features();
@@ -2297,6 +2298,9 @@ public:
const gms::feature& cluster_supports_truncation_table() const {
return _truncation_table;
}
const gms::feature& cluster_supports_correct_static_compact_in_mc() const {
return _correct_static_compact_in_mc;
}
private:
future<> set_cql_ready(bool ready);
private: