repair: row_level: coroutinize repair_meta::get_full_row_hashes_sink_op()

Extra care is needed for exception handling.
This commit is contained in:
Avi Kivity
2024-08-25 16:19:38 +03:00
parent 8e9ebd82fc
commit a35942e09a

View File

@@ -1530,13 +1530,17 @@ private:
}
future<> get_full_row_hashes_sink_op(rpc::sink<repair_stream_cmd>& sink) {
return sink(repair_stream_cmd::get_full_row_hashes).then([&sink] {
return sink.flush();
}).handle_exception([&sink] (std::exception_ptr ep) {
return sink.close().then([ep = std::move(ep)] () mutable {
return make_exception_future<>(std::move(ep));
});
});
std::exception_ptr ep;
try {
co_await sink(repair_stream_cmd::get_full_row_hashes);
co_await sink.flush();
} catch (...) {
ep = std::current_exception();
}
if (ep) {
co_await sink.close();
std::rethrow_exception(ep);
}
}
public: