service: add computed columns feature

Computed columns feature should be checked before creating
index schemas the new way - by adding computed column names
to system_schema.computed_columns.
This commit is contained in:
Piotr Sarna
2019-03-15 09:40:45 +01:00
parent a1100e3737
commit a0e02df36a
3 changed files with 16 additions and 1 deletions

View File

@@ -32,11 +32,13 @@ enum class schema_feature {
// tombstones in an empty partition expire.
// See https://github.com/scylladb/scylla/issues/4485
DIGEST_INSENSITIVE_TO_EXPIRY,
COMPUTED_COLUMNS,
};
using schema_features = enum_set<super_enum<schema_feature,
schema_feature::VIEW_VIRTUAL_COLUMNS,
schema_feature::DIGEST_INSENSITIVE_TO_EXPIRY
schema_feature::DIGEST_INSENSITIVE_TO_EXPIRY,
schema_feature::COMPUTED_COLUMNS
>>;
}

View File

@@ -111,6 +111,7 @@ static const sstring CORRECT_STATIC_COMPACT_IN_MC = "CORRECT_STATIC_COMPACT_IN_M
static const sstring UNBOUNDED_RANGE_TOMBSTONES_FEATURE = "UNBOUNDED_RANGE_TOMBSTONES";
static const sstring VIEW_VIRTUAL_COLUMNS = "VIEW_VIRTUAL_COLUMNS";
static const sstring DIGEST_INSENSITIVE_TO_EXPIRY = "DIGEST_INSENSITIVE_TO_EXPIRY";
static const sstring COMPUTED_COLUMNS_FEATURE = "COMPUTED_COLUMNS";
static const sstring SSTABLE_FORMAT_PARAM_NAME = "sstable_format";
@@ -164,6 +165,7 @@ storage_service::storage_service(distributed<database>& db, gms::gossiper& gossi
, _unbounded_range_tombstones_feature(_feature_service, UNBOUNDED_RANGE_TOMBSTONES_FEATURE)
, _view_virtual_columns(_feature_service, VIEW_VIRTUAL_COLUMNS)
, _digest_insensitive_to_expiry(_feature_service, DIGEST_INSENSITIVE_TO_EXPIRY)
, _computed_columns(_feature_service, COMPUTED_COLUMNS_FEATURE)
, _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(); })
@@ -218,6 +220,7 @@ void storage_service::enable_all_features() {
std::ref(_unbounded_range_tombstones_feature),
std::ref(_view_virtual_columns),
std::ref(_digest_insensitive_to_expiry),
std::ref(_computed_columns),
})
{
if (features.count(f.name())) {
@@ -322,6 +325,7 @@ std::set<sstring> storage_service::get_config_supported_features_set() {
CORRECT_STATIC_COMPACT_IN_MC,
VIEW_VIRTUAL_COLUMNS,
DIGEST_INSENSITIVE_TO_EXPIRY,
COMPUTED_COLUMNS_FEATURE,
};
// Do not respect config in the case database is not started
@@ -3508,6 +3512,7 @@ db::schema_features storage_service::cluster_schema_features() const {
db::schema_features f;
f.set_if<db::schema_feature::VIEW_VIRTUAL_COLUMNS>(bool(_view_virtual_columns));
f.set_if<db::schema_feature::DIGEST_INSENSITIVE_TO_EXPIRY>(bool(_digest_insensitive_to_expiry));
f.set_if<db::schema_feature::COMPUTED_COLUMNS>(bool(_computed_columns));
return f;
}

View File

@@ -332,6 +332,7 @@ private:
gms::feature _unbounded_range_tombstones_feature;
gms::feature _view_virtual_columns;
gms::feature _digest_insensitive_to_expiry;
gms::feature _computed_columns;
sstables::sstable_version_types _sstables_format = sstables::sstable_version_types::ka;
seastar::semaphore _feature_listeners_sem = {1};
@@ -2344,14 +2345,21 @@ 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;
}
const gms::feature& cluster_supports_digest_insensitive_to_expiry() const {
return _digest_insensitive_to_expiry;
}
bool cluster_supports_computed_columns() const {
return bool(_computed_columns);
}
// Returns schema features which all nodes in the cluster advertise as supported.
db::schema_features cluster_schema_features() const;
private:
future<> set_cql_ready(bool ready);
private: