From c6b7fcc26f41d523d2f982940877ff8affe486a2 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Fri, 30 Dec 2022 10:13:28 +0200 Subject: [PATCH] distributed_loader: reshard: capture creator by ref Now that reshard is a coroutine, creator is preserved in the coroutine frame until completion so we can simply capture it by reference now. Note that previously it was moved into the compaction descriptor, but the capture wasn't mutable so it was copied anyhow and this change doesn't introduced a regression. Signed-off-by: Benny Halevy --- replica/distributed_loader.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/replica/distributed_loader.cc b/replica/distributed_loader.cc index 5ce06a009e..4d74c269e3 100644 --- a/replica/distributed_loader.cc +++ b/replica/distributed_loader.cc @@ -235,11 +235,11 @@ future<> reshard(sstables::sstable_directory& dir, sstables::sstable_directory:: // There is a semaphore inside the compaction manager in run_resharding_jobs. So we // parallel_for_each so the statistics about pending jobs are updated to reflect all // jobs. But only one will run in parallel at a time - co_await coroutine::parallel_for_each(buckets, [&dir, &table, creator = std::move(creator), iop] (std::vector& sstlist) mutable { + co_await coroutine::parallel_for_each(buckets, [&] (std::vector& sstlist) mutable { return table.get_compaction_manager().run_custom_job(table.as_table_state(), sstables::compaction_type::Reshard, "Reshard compaction", [&dir, &table, creator, &sstlist, iop] (sstables::compaction_data& info) -> future<> { sstables::compaction_descriptor desc(sstlist, iop); desc.options = sstables::compaction_type_options::make_reshard(); - desc.creator = std::move(creator); + desc.creator = creator; auto result = co_await sstables::compact_sstables(std::move(desc), info, table.as_table_state()); // input sstables are moved, to guarantee their resources are released once we're done