From f57b194db0ba9a0bb1eb308e1a343c149030f723 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 22 Jan 2024 17:30:40 +0300 Subject: [PATCH] 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 --- main.cc | 3 ++- service/tablet_allocator.cc | 11 +++++++---- service/tablet_allocator.hh | 4 +++- test/lib/cql_test_env.cc | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/main.cc b/main.cc index 2a0e4332f3..e12e4a35dc 100644 --- a/main.cc +++ b/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 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(); }); diff --git a/service/tablet_allocator.cc b/service/tablet_allocator.cc index 4167ff86da..d1f5f4cf6f 100644 --- a/service/tablet_allocator.cc +++ b/service/tablet_allocator.cc @@ -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(mn, db)) { +tablet_allocator::tablet_allocator(config cfg, service::migration_notifier& mn, replica::database& db) + : _impl(std::make_unique(std::move(cfg), mn, db)) { } future<> tablet_allocator::stop() { diff --git a/service/tablet_allocator.hh b/service/tablet_allocator.hh index 064b01a0b4..d25f8a6bc1 100644 --- a/service/tablet_allocator.hh +++ b/service/tablet_allocator.hh @@ -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; 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(); diff --git a/test/lib/cql_test_env.cc b/test/lib/cql_test_env.cc index 50199ad60a..e84fd2fd6e 100644 --- a/test/lib/cql_test_env.cc +++ b/test/lib/cql_test_env.cc @@ -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(); });