From 6aa71205d8cbe7e4a6f96c1901f7a835ece566ee Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Sun, 29 Jun 2025 22:23:36 +0300 Subject: [PATCH] repair: row_level: unstall to_repair_rows_on_wire() destroying its input to_repair_rows_on_wire() moves the contents of its input std::list and is careful to yield after each element, but the final destruction of the input list still deals with all of the list elements without yielding. This is expensive as not all contents of repair_row are moved (_dk_with_hash is of type lw_shared_ptr). To fix, destroy each row element as we move along. This is safe as we own the input and don't reference row_list other than for the iteration. Fixes #24725. Closes scylladb/scylladb#24726 --- repair/row_level.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repair/row_level.cc b/repair/row_level.cc index 8eccf34a51..16b10b5306 100644 --- a/repair/row_level.cc +++ b/repair/row_level.cc @@ -1448,7 +1448,9 @@ private: size_t row_bytes = co_await get_repair_rows_size(row_list); _metrics.tx_row_nr += row_list.size(); _metrics.tx_row_bytes += row_bytes; - for (repair_row& r : row_list) { + while (!row_list.empty()) { + repair_row r = std::move(row_list.front()); + row_list.pop_front(); const auto& dk_with_hash = r.get_dk_with_hash(); // No need to search from the beginning of the rows. Look at the end of repair_rows_on_wire is enough. if (rows.empty()) {