From c16369323b29c137e5e749ad17d7c00a697ddee3 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 28 Oct 2024 17:32:38 +0300 Subject: [PATCH] sstables: Use inject(wait_for_message_overload) This place could be in the pre-previous patch, it just can use the overload, but it seemengly has a bug. It prints _two_ messages -- that the injection handler was suspended and that it was woken up. The bug is in the 2nd message -- it's printed without waiting for the message, so it likely gets printed before wakeup itself. It seems that no tests care about it though. Signed-off-by: Pavel Emelyanov --- sstables/sstables.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/sstables/sstables.cc b/sstables/sstables.cc index 6297f15e21..b5e0631a89 100644 --- a/sstables/sstables.cc +++ b/sstables/sstables.cc @@ -1548,12 +1548,7 @@ future<> sstable::reload_reclaimed_components() { co_return; } - co_await utils::get_local_injector().inject("reload_reclaimed_components/pause", [] (auto& handler) { - sstlog.info("reload_reclaimed_components/pause init"); - auto ret = handler.wait_for_message(std::chrono::steady_clock::now() + std::chrono::seconds{5}); - sstlog.info("reload_reclaimed_components/pause done"); - return ret; - }); + co_await utils::get_local_injector().inject("reload_reclaimed_components/pause", utils::wait_for_message(std::chrono::seconds(5))); co_await read_filter(); _total_reclaimable_memory.reset(); @@ -1957,12 +1952,7 @@ future sstable::validate(reader_permit permit, abort_source& abort, if (errors) { co_return errors; } - co_await utils::get_local_injector().inject("sstable_validate/pause", [] (auto& handler) { - sstlog.info("sstable_validate/pause init"); - auto ret = handler.wait_for_message(std::chrono::steady_clock::now() + std::chrono::seconds{5}); - sstlog.info("sstable_validate/pause done"); - return ret; - }); + co_await utils::get_local_injector().inject("sstable_validate/pause", utils::wait_for_message(std::chrono::seconds(5))); if (_version >= sstable_version_types::mc) { co_return co_await mx::validate(shared_from_this(), std::move(permit), abort, std::move(error_handler), monitor);