tablet_allocator: Start even if tablets feature is not enabled

topology coordinator will call it. Rather than spreading ifs there,
it's simpler to start it and disable functionality in the tablet
allocator.
This commit is contained in:
Tomasz Grabiec
2023-08-05 21:46:42 +02:00
parent 5bfc8b0445
commit cb0d763a22
2 changed files with 7 additions and 5 deletions

View File

@@ -1228,13 +1228,12 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
gossiper.local(), feature_service.local(), sys_ks.local(), group0_client};
distributed<service::tablet_allocator> tablet_allocator;
if (cfg->check_experimental(db::experimental_features_t::feature::TABLETS)) {
if (!cfg->check_experimental(db::experimental_features_t::feature::CONSISTENT_TOPOLOGY_CHANGES)) {
if (cfg->check_experimental(db::experimental_features_t::feature::TABLETS) &&
!cfg->check_experimental(db::experimental_features_t::feature::CONSISTENT_TOPOLOGY_CHANGES)) {
startlog.error("Bad configuration: The consistent-topology-changes feature has to be enabled if tablets feature is enabled");
throw bad_configuration_error();
}
tablet_allocator.start(std::ref(mm_notifier), std::ref(db)).get();
}
tablet_allocator.start(std::ref(mm_notifier), std::ref(db)).get();
auto stop_tablet_allocator = defer_verbose_shutdown("tablet allocator", [&tablet_allocator] {
tablet_allocator.stop().get();
});

View File

@@ -14,6 +14,7 @@
#include "service/tablet_allocator.hh"
#include "utils/error_injection.hh"
#include "utils/stall_free.hh"
#include "db/config.hh"
#include "locator/load_sketch.hh"
#include "utils/div_ceil.hh"
@@ -555,7 +556,9 @@ public:
tablet_allocator_impl(service::migration_notifier& mn, replica::database& db)
: _migration_notifier(mn)
, _db(db) {
_migration_notifier.register_listener(this);
if (db.get_config().check_experimental(db::experimental_features_t::feature::TABLETS)) {
_migration_notifier.register_listener(this);
}
}
tablet_allocator_impl(tablet_allocator_impl&&) = delete; // "this" captured.