storage_service: Introduce the VIEW_VIRTUAL_COLUMNS cluster feature

Needed for determining if all nodes in the cluster are aware of the
new schema table. Only when all nodes are aware of it we can take it
into account when calculating schema digest, otherwise there would be
permanent schema disagreement in during rolling upgrade.
This commit is contained in:
Tomasz Grabiec
2019-04-24 17:04:52 +02:00
parent 73b859005c
commit a108df09f9
2 changed files with 11 additions and 1 deletions

View File

@@ -109,6 +109,7 @@ 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";
static const sstring UNBOUNDED_RANGE_TOMBSTONES_FEATURE = "UNBOUNDED_RANGE_TOMBSTONES";
static const sstring VIEW_VIRTUAL_COLUMNS = "VIEW_VIRTUAL_COLUMNS";
static const sstring SSTABLE_FORMAT_PARAM_NAME = "sstable_format";
@@ -160,6 +161,7 @@ storage_service::storage_service(distributed<database>& db, gms::gossiper& gossi
, _truncation_table(_feature_service, TRUNCATION_TABLE)
, _correct_static_compact_in_mc(_feature_service, CORRECT_STATIC_COMPACT_IN_MC)
, _unbounded_range_tombstones_feature(_feature_service, UNBOUNDED_RANGE_TOMBSTONES_FEATURE)
, _view_virtual_columns(_feature_service, VIEW_VIRTUAL_COLUMNS)
, _la_feature_listener(*this, _feature_listeners_sem, sstables::sstable_version_types::la)
, _mc_feature_listener(*this, _feature_listeners_sem, sstables::sstable_version_types::mc)
, _replicate_action([this] { return do_replicate_to_all_cores(); })
@@ -205,6 +207,7 @@ void storage_service::enable_all_features() {
std::ref(_truncation_table),
std::ref(_correct_static_compact_in_mc),
std::ref(_unbounded_range_tombstones_feature),
std::ref(_view_virtual_columns),
})
{
if (features.count(f.name())) {
@@ -307,6 +310,7 @@ std::set<sstring> storage_service::get_config_supported_features_set() {
ROW_LEVEL_REPAIR,
TRUNCATION_TABLE,
CORRECT_STATIC_COMPACT_IN_MC,
VIEW_VIRTUAL_COLUMNS,
};
// Do not respect config in the case database is not started
@@ -3473,7 +3477,9 @@ void storage_service::notify_cql_change(inet_address endpoint, bool ready)
}
db::schema_features storage_service::cluster_schema_features() const {
return db::schema_features();
db::schema_features f;
f.set_if<db::schema_feature::VIEW_VIRTUAL_COLUMNS>(bool(_view_virtual_columns));
return f;
}
} // namespace service

View File

@@ -322,6 +322,7 @@ private:
gms::feature _truncation_table;
gms::feature _correct_static_compact_in_mc;
gms::feature _unbounded_range_tombstones_feature;
gms::feature _view_virtual_columns;
sstables::sstable_version_types _sstables_format = sstables::sstable_version_types::ka;
seastar::semaphore _feature_listeners_sem = {1};
@@ -2334,6 +2335,9 @@ public:
bool cluster_supports_unbounded_range_tombstones() const {
return bool(_unbounded_range_tombstones_feature);
}
const gms::feature& cluster_supports_view_virtual_columns() const {
return _view_virtual_columns;
}
// Returns schema features which all nodes in the cluster advertise as supported.
db::schema_features cluster_schema_features() const;
private: