mv: add an experimental feature for creating views using tablets

We still have a number of issues to be solved for views with tablets.
Until they are fixed, we should prevent users from creating them,
and use the vnode-based views instead.

This patch prepares the feature for enabling views with tablets. The
feature is disabled by default, but currently it has no effect.
After all tests are adjusted to use the feature, we should depend
on the feature for deciding whether we can create materialized views
in tablet-enabled keyspaces.

The unit tests are adjusted to enable this feature explicitly, and it's
also added to the scylla sstable tool config - this tool treats all
tables as if they were tablet-based (surprisingly, with SimpleStrategy),
so for it to work on views, the new feature must be enabled.

Refs scylladb/scylladb#21832

Closes scylladb/scylladb#21833
This commit is contained in:
Wojciech Mitros
2024-12-02 22:16:55 +01:00
committed by Piotr Dulikowski
parent 115005d863
commit d04f376227
10 changed files with 14 additions and 1 deletions

View File

@@ -29,6 +29,7 @@
#include "gms/feature_service.hh"
#include "db/view/view.hh"
#include "service/migration_manager.hh"
#include "replica/database.hh"
namespace cql3 {

View File

@@ -1447,6 +1447,7 @@ std::map<sstring, db::experimental_features_t::feature> db::experimental_feature
{"broadcast-tables", feature::BROADCAST_TABLES},
{"keyspace-storage-options", feature::KEYSPACE_STORAGE_OPTIONS},
{"tablets", feature::UNUSED},
{"views-with-tablets", feature::VIEWS_WITH_TABLETS}
};
}

View File

@@ -109,6 +109,7 @@ struct experimental_features_t {
ALTERNATOR_STREAMS,
BROADCAST_TABLES,
KEYSPACE_STORAGE_OPTIONS,
VIEWS_WITH_TABLETS
};
static std::map<sstring, feature> map(); // See enum_option.
static std::vector<enum_option<experimental_features_t>> all();

View File

@@ -82,6 +82,9 @@ feature_config feature_config_from_db_config(const db::config& cfg, std::set<sst
if (!cfg.check_experimental(db::experimental_features_t::feature::KEYSPACE_STORAGE_OPTIONS)) {
fcfg._disabled_features.insert("KEYSPACE_STORAGE_OPTIONS"s);
}
if (!cfg.check_experimental(db::experimental_features_t::feature::VIEWS_WITH_TABLETS)) {
fcfg._disabled_features.insert("VIEWS_WITH_TABLETS"s);
}
if (cfg.force_gossip_topology_changes()) {
if (cfg.enable_tablets()) {
throw std::runtime_error("Tablets cannot be enabled with gossip topology changes. Use either --enable-tablets or --force-gossip-topology-changes, not both.");

View File

@@ -135,6 +135,7 @@ public:
gms::feature native_reverse_queries { *this, "NATIVE_REVERSE_QUERIES"sv };
gms::feature zero_token_nodes { *this, "ZERO_TOKEN_NODES"sv };
gms::feature view_build_status_on_group0 { *this, "VIEW_BUILD_STATUS_ON_GROUP0"sv };
gms::feature views_with_tablets { *this, "VIEWS_WITH_TABLETS"sv };
// Whether to allow fragmented commitlog entries. While this is a node-local feature as such, hide
// behind a feature to ensure an upgrading cluster appears to be at least functional before using,

View File

@@ -312,6 +312,7 @@ def run_scylla_cmd(pid, dir):
# test/alternator/run.
'--experimental-features=udf',
'--experimental-features=keyspace-storage-options',
'--experimental-features=views-with-tablets',
'--enable-tablets=true',
'--enable-user-defined-functions', '1',
# Set up authentication in order to allow testing this module

View File

@@ -5,4 +5,5 @@ dirties_cluster:
extra_scylla_cmdline_options:
- '--experimental-features=udf'
- '--experimental-features=keyspace-storage-options'
- '--experimental-features=views-with-tablets'
- '--enable-tablets=true'

View File

@@ -100,7 +100,8 @@ def make_scylla_conf(mode: str, workdir: pathlib.Path, host_addr: str, seed_addr
'experimental_features': ['udf',
'alternator-streams',
'broadcast-tables',
'keyspace-storage-options'],
'keyspace-storage-options',
'views-with-tablets'],
'skip_wait_for_gossip_to_settle': 0,
'ring_delay_ms': 0,

View File

@@ -8,3 +8,4 @@ skip_in_release:
extra_scylla_cmdline_options:
- '--experimental-features=udf'
- '--enable-tablets=true'
- '--experimental-features=views-with-tablets'

View File

@@ -237,6 +237,8 @@ std::vector<schema_ptr> do_load_schemas(const db::config& cfg, std::string_view
gms::feature_service feature_service(gms::feature_config_from_db_config(cfg));
feature_service.enable(feature_service.supported_feature_set()).get();
feature_service.views_with_tablets.enable();
sharded<locator::shared_token_metadata> token_metadata;
auto my_address = gms::inet_address("localhost");