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 <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-03-08 10:56:57 +02:00
parent d0f693a517
commit cb2403e917

View File

@@ -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);