tablet_allocator: Add config
Tablet allocator is a sharded service, that starts in main, it's worth equipping it with a config. Next patches will fill it with some payload Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
3
main.cc
3
main.cc
@@ -1363,13 +1363,14 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
|
||||
stop_signal.as_local_abort_source(), raft_gr.local(), messaging,
|
||||
gossiper.local(), feature_service.local(), sys_ks.local(), group0_client};
|
||||
|
||||
service::tablet_allocator::config tacfg;
|
||||
distributed<service::tablet_allocator> tablet_allocator;
|
||||
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(tacfg, std::ref(mm_notifier), std::ref(db)).get();
|
||||
auto stop_tablet_allocator = defer_verbose_shutdown("tablet allocator", [&tablet_allocator] {
|
||||
tablet_allocator.stop().get();
|
||||
});
|
||||
|
||||
@@ -794,14 +794,17 @@ public:
|
||||
|
||||
class tablet_allocator_impl : public tablet_allocator::impl
|
||||
, public service::migration_listener::empty_listener {
|
||||
const tablet_allocator::config _config;
|
||||
service::migration_notifier& _migration_notifier;
|
||||
replica::database& _db;
|
||||
load_balancer_stats_manager _load_balancer_stats;
|
||||
bool _stopped = false;
|
||||
public:
|
||||
tablet_allocator_impl(service::migration_notifier& mn, replica::database& db)
|
||||
: _migration_notifier(mn)
|
||||
tablet_allocator_impl(tablet_allocator::config cfg, service::migration_notifier& mn, replica::database& db)
|
||||
: _config(std::move(cfg))
|
||||
, _migration_notifier(mn)
|
||||
, _db(db) {
|
||||
(void)_config;
|
||||
if (db.get_config().check_experimental(db::experimental_features_t::feature::TABLETS)) {
|
||||
_migration_notifier.register_listener(this);
|
||||
}
|
||||
@@ -861,8 +864,8 @@ public:
|
||||
// FIXME: Handle materialized views.
|
||||
};
|
||||
|
||||
tablet_allocator::tablet_allocator(service::migration_notifier& mn, replica::database& db)
|
||||
: _impl(std::make_unique<tablet_allocator_impl>(mn, db)) {
|
||||
tablet_allocator::tablet_allocator(config cfg, service::migration_notifier& mn, replica::database& db)
|
||||
: _impl(std::make_unique<tablet_allocator_impl>(std::move(cfg), mn, db)) {
|
||||
}
|
||||
|
||||
future<> tablet_allocator::stop() {
|
||||
|
||||
@@ -52,6 +52,8 @@ class tablet_allocator_impl;
|
||||
|
||||
class tablet_allocator {
|
||||
public:
|
||||
struct config {
|
||||
};
|
||||
class impl {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
@@ -60,7 +62,7 @@ private:
|
||||
std::unique_ptr<impl> _impl;
|
||||
tablet_allocator_impl& impl();
|
||||
public:
|
||||
tablet_allocator(service::migration_notifier& mn, replica::database& db);
|
||||
tablet_allocator(config cfg, service::migration_notifier& mn, replica::database& db);
|
||||
public:
|
||||
future<> stop();
|
||||
|
||||
|
||||
@@ -745,7 +745,7 @@ private:
|
||||
_mm.start(std::ref(_mnotifier), std::ref(_feature_service), std::ref(_ms), std::ref(_proxy), std::ref(_gossiper), std::ref(group0_client), std::ref(_sys_ks)).get();
|
||||
auto stop_mm = defer([this] { _mm.stop().get(); });
|
||||
|
||||
_tablet_allocator.start(std::ref(_mnotifier), std::ref(_db)).get();
|
||||
_tablet_allocator.start(service::tablet_allocator::config{}, std::ref(_mnotifier), std::ref(_db)).get();
|
||||
auto stop_tablet_allocator = defer([this] {
|
||||
_tablet_allocator.stop().get();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user