From 7f15cc446f0c9ec9cc445b84bfc5ea0bedaa4fc6 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sat, 24 Aug 2024 00:40:27 +0300 Subject: [PATCH] repair: row_level: coroutinize repair_meta::copy_rows_from_working_row_buf_within_set_diff() coroutine::maybe_yield() introduced to compensate for loss of stall-protected do_for_each() --- repair/row_level.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/repair/row_level.cc b/repair/row_level.cc index 7745ebf50b..abc3a205c4 100644 --- a/repair/row_level.cc +++ b/repair/row_level.cc @@ -1342,16 +1342,18 @@ private: future> copy_rows_from_working_row_buf_within_set_diff(repair_hash_set set_diff) { - return do_with(std::list(), std::move(set_diff), - [this] (std::list& rows, repair_hash_set& set_diff) { - return do_for_each(_working_row_buf, [&set_diff, &rows] (const repair_row& r) { + std::list rows; + { + for (const repair_row& r : _working_row_buf) { if (set_diff.contains(r.hash())) { rows.push_back(r); } - }).then([&rows] { - return std::move(rows); - }); - }); + co_await coroutine::maybe_yield(); + } + { + co_return rows; + } + } } // Return rows in the _working_row_buf with hash within the given sef_diff