From cb2403e91704ef74a4812ff5f4e20f65ea9f3f2c Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Tue, 8 Mar 2022 10:56:57 +0200 Subject: [PATCH] compaction_manager: rewrite_sstables: acquire _maintenance_ops_sem once Like all other maintenance operations, acquire the _maintenance_ops_sem once for the whole task, rather than for each sstable. Signed-off-by: Benny Halevy --- compaction/compaction_manager.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compaction/compaction_manager.cc b/compaction/compaction_manager.cc index 14b17caf15..9e55222286 100644 --- a/compaction/compaction_manager.cc +++ b/compaction/compaction_manager.cc @@ -791,6 +791,8 @@ future<> compaction_manager::rewrite_sstables(replica::table* t, sstables::compa cmlog.debug("{} task {} table={}: done", options.type(), fmt::ptr(task.get()), fmt::ptr(task->compacting_table)); }); + auto maintenance_permit = co_await seastar::get_units(_maintenance_ops_sem, 1); + auto rewrite_sstable = [this, &task, &options, &compacting, can_purge] (const sstables::shared_sstable& sst) mutable -> future<> { stop_iteration completed = stop_iteration::no; do { @@ -807,8 +809,6 @@ future<> compaction_manager::rewrite_sstables(replica::table* t, sstables::compa compacting.release_compacting(exhausted_sstables); }; - auto maintenance_permit = co_await seastar::get_units(_maintenance_ops_sem, 1); - _stats.pending_tasks--; _stats.active_tasks++; task->setup_new_compaction(descriptor.run_identifier);