From fbb59fc920b5905ff23fc04bbbf2f34b3f236b30 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 10 Jun 2022 14:21:08 +0300 Subject: [PATCH] compaction_manager: Keep compaction_sg on board This is mainly to make next patch simpler. Also this makes the backlog controller API smaller by removing its sg() method. Signed-off-by: Pavel Emelyanov --- backlog_controller.hh | 3 --- compaction/compaction_manager.cc | 10 ++++++---- compaction/compaction_manager.hh | 1 + 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backlog_controller.hh b/backlog_controller.hh index a98d037507..4f582c9d25 100644 --- a/backlog_controller.hh +++ b/backlog_controller.hh @@ -90,9 +90,6 @@ protected: public: backlog_controller(backlog_controller&&) = default; float backlog_of_shares(float shares) const; - seastar::scheduling_group sg() { - return _scheduling_group; - } }; // memtable flush CPU controller. diff --git a/compaction/compaction_manager.cc b/compaction/compaction_manager.cc index 4cbbcf6289..23950c4592 100644 --- a/compaction/compaction_manager.cc +++ b/compaction/compaction_manager.cc @@ -337,7 +337,7 @@ protected: // it cannot be the other way around, or minor compaction for this table would be // prevented while an ongoing major compaction doesn't release the semaphore. virtual future<> do_run() override { - co_await coroutine::switch_to(_cm._compaction_controller.sg()); + co_await coroutine::switch_to(_cm._compaction_sg.cpu); switch_state(state::pending); auto units = co_await acquire_semaphore(_cm._maintenance_ops_sem); @@ -609,6 +609,7 @@ compaction_manager::compaction_manager(scheduling_group csg, scheduling_group ms return b; })) , _backlog_manager(_compaction_controller) + , _compaction_sg(csg) , _maintenance_sg(msg) , _available_memory(available_memory) , _early_abort_subscription(as.subscribe([this] () noexcept { @@ -622,6 +623,7 @@ compaction_manager::compaction_manager(scheduling_group csg, scheduling_group ms compaction_manager::compaction_manager() : _compaction_controller(seastar::default_scheduling_group(), default_priority_class(), 1) , _backlog_manager(_compaction_controller) + , _compaction_sg(scheduling_group{default_scheduling_group(), default_priority_class()}) , _maintenance_sg(scheduling_group{default_scheduling_group(), default_priority_class()}) , _available_memory(1) , _strategy_control(std::make_unique(*this)) @@ -839,7 +841,7 @@ public: {} protected: virtual future<> do_run() override { - co_await coroutine::switch_to(_cm._compaction_controller.sg()); + co_await coroutine::switch_to(_cm._compaction_sg.cpu); for (;;) { if (!can_proceed()) { @@ -1073,7 +1075,7 @@ protected: private: future<> rewrite_sstable(const sstables::shared_sstable sst) { - co_await coroutine::switch_to(_cm._compaction_controller.sg()); + co_await coroutine::switch_to(_cm._compaction_sg.cpu); for (;;) { switch_state(state::active); @@ -1242,7 +1244,7 @@ private: } future<> run_cleanup_job(sstables::compaction_descriptor descriptor) { - co_await coroutine::switch_to(_cm._compaction_controller.sg()); + co_await coroutine::switch_to(_cm._compaction_sg.cpu); for (;;) { compaction_backlog_tracker user_initiated(std::make_unique(_cm._compaction_controller.backlog_of_shares(200), _cm._available_memory)); diff --git a/compaction/compaction_manager.hh b/compaction/compaction_manager.hh index ce333cfece..4e8122c65e 100644 --- a/compaction/compaction_manager.hh +++ b/compaction/compaction_manager.hh @@ -282,6 +282,7 @@ private: compaction_controller _compaction_controller; compaction_backlog_manager _backlog_manager; + scheduling_group _compaction_sg; scheduling_group _maintenance_sg; size_t _available_memory; optimized_optional _early_abort_subscription;