shard_reader_v2: do_fill_buffer: maybe yield when copying result

Prevent a reactor stall with e.g. large number of range tombstones.

Fixes #10314

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20220402130847.625085-1-bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-04-02 16:08:46 +03:00
committed by Nadav Har'El
parent 9c96a37143
commit 8ab57aa4ab

View File

@@ -8,6 +8,7 @@
#include <boost/range/algorithm/heap_algorithm.hpp>
#include <seastar/core/coroutine.hh>
#include <seastar/coroutine/maybe_yield.hh>
#include <seastar/util/closeable.hh>
#include "dht/sharder.hh"
@@ -845,12 +846,12 @@ future<> shard_reader_v2::do_fill_buffer() {
});
}
return fill_buf_fut.then([this] (remote_fill_buffer_result_v2 res) mutable {
_end_of_stream = res.end_of_stream;
for (const auto& mf : *res.buffer) {
push_mutation_fragment(mutation_fragment_v2(*_schema, _permit, mf));
}
});
auto res = co_await(std::move(fill_buf_fut));
_end_of_stream = res.end_of_stream;
for (const auto& mf : *res.buffer) {
push_mutation_fragment(mutation_fragment_v2(*_schema, _permit, mf));
co_await coroutine::maybe_yield();
}
}
future<> shard_reader_v2::fill_buffer() {