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()
This commit is contained in:
Avi Kivity
2024-08-24 00:40:27 +03:00
parent 93ca202bd3
commit 7f15cc446f

View File

@@ -1342,16 +1342,18 @@ private:
future<std::list<repair_row>>
copy_rows_from_working_row_buf_within_set_diff(repair_hash_set set_diff) {
return do_with(std::list<repair_row>(), std::move(set_diff),
[this] (std::list<repair_row>& rows, repair_hash_set& set_diff) {
return do_for_each(_working_row_buf, [&set_diff, &rows] (const repair_row& r) {
std::list<repair_row> 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