db: config: add BROADCAST_TABLES feature flag
Add experimental flag 'broadcast-tables' for enabling BROADCAST_TABLES feature. This feature requires raft group0, thus enabling it without RAFT will cause an error.
This commit is contained in:
@@ -1014,7 +1014,8 @@ db::fs::path db::config::get_conf_sub(db::fs::path sub) {
|
||||
bool db::config::check_experimental(experimental_features_t::feature f) const {
|
||||
if (experimental()
|
||||
&& f != experimental_features_t::feature::UNUSED
|
||||
&& f != experimental_features_t::feature::RAFT) {
|
||||
&& f != experimental_features_t::feature::RAFT
|
||||
&& f != experimental_features_t::feature::BROADCAST_TABLES) {
|
||||
return true;
|
||||
}
|
||||
const auto& optval = experimental_features();
|
||||
@@ -1058,6 +1059,7 @@ std::map<sstring, db::experimental_features_t::feature> db::experimental_feature
|
||||
{"alternator-streams", feature::ALTERNATOR_STREAMS},
|
||||
{"alternator-ttl", feature::ALTERNATOR_TTL},
|
||||
{"raft", feature::RAFT},
|
||||
{"broadcast-tables", feature::BROADCAST_TABLES},
|
||||
{"keyspace-storage-options", feature::KEYSPACE_STORAGE_OPTIONS},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,10 +81,11 @@ namespace db {
|
||||
|
||||
/// Enumeration of all valid values for the `experimental` config entry.
|
||||
struct experimental_features_t {
|
||||
// NOTE: RAFT feature is not enabled via `experimental` umbrella flag.
|
||||
// This option should be enabled explicitly.
|
||||
// NOTE: RAFT and BROADCAST_TABLES features are not enabled via `experimental` umbrella flag.
|
||||
// These options should be enabled explicitly.
|
||||
// RAFT feature has to be enabled if BROADCAST_TABLES is enabled.
|
||||
enum class feature { UNUSED, UDF, ALTERNATOR_STREAMS, ALTERNATOR_TTL, RAFT,
|
||||
KEYSPACE_STORAGE_OPTIONS };
|
||||
BROADCAST_TABLES, KEYSPACE_STORAGE_OPTIONS };
|
||||
static std::map<sstring, feature> map(); // See enum_option.
|
||||
static std::vector<enum_option<experimental_features_t>> all();
|
||||
};
|
||||
|
||||
5
main.cc
5
main.cc
@@ -1041,6 +1041,11 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
});
|
||||
if (cfg->check_experimental(db::experimental_features_t::feature::RAFT)) {
|
||||
supervisor::notify("starting Raft Group Registry service");
|
||||
} else {
|
||||
if (cfg->check_experimental(db::experimental_features_t::feature::BROADCAST_TABLES)) {
|
||||
startlog.error("Bad configuration: RAFT feature has to be enabled if BROADCAST_TABLES is enabled");
|
||||
throw bad_configuration_error();
|
||||
}
|
||||
}
|
||||
raft_gr.invoke_on_all(&service::raft_group_registry::start).get();
|
||||
|
||||
|
||||
@@ -975,6 +975,21 @@ SEASTAR_TEST_CASE(test_parse_experimental_features_raft) {
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::UDF));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::ALTERNATOR_STREAMS));
|
||||
BOOST_CHECK(cfg.check_experimental(ef::RAFT));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::BROADCAST_TABLES));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::KEYSPACE_STORAGE_OPTIONS));
|
||||
return make_ready_future();
|
||||
}
|
||||
|
||||
SEASTAR_TEST_CASE(test_parse_experimental_features_broadcast_tables) {
|
||||
auto cfg_ptr = std::make_unique<config>();
|
||||
config& cfg = *cfg_ptr;
|
||||
cfg.read_from_yaml("experimental_features:\n - broadcast-tables\n", throw_on_error);
|
||||
BOOST_CHECK_EQUAL(cfg.experimental_features(), features{ef::BROADCAST_TABLES});
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::UNUSED));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::UDF));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::ALTERNATOR_STREAMS));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::RAFT));
|
||||
BOOST_CHECK(cfg.check_experimental(ef::BROADCAST_TABLES));
|
||||
BOOST_CHECK(!cfg.check_experimental(ef::KEYSPACE_STORAGE_OPTIONS));
|
||||
return make_ready_future();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user