From a108df09f9d26a8a8ea0fba3d0e64d5edad51cd0 Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Wed, 24 Apr 2019 17:04:52 +0200 Subject: [PATCH] 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. --- service/storage_service.cc | 8 +++++++- service/storage_service.hh | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index 9a1ec185e5..ef83ae743b 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -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& 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 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(bool(_view_virtual_columns)); + return f; } } // namespace service diff --git a/service/storage_service.hh b/service/storage_service.hh index bbd9525e72..6bb8e8acc7 100644 --- a/service/storage_service.hh +++ b/service/storage_service.hh @@ -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: