From fc729a804b5ae9fa8bd8de33ef63aeae4dd3ccf9 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Sun, 2 Jan 2022 14:46:36 +0200 Subject: [PATCH] shard_reader: Continue after read_ahead error If read ahead failed, just issue a log warning and proceed to close the reader. Currently co_await will throw and the evictable reader won't be closed. This is seen occasionally in testing, e.g. https://jenkins.scylladb.com/view/master/job/scylla-master/job/dtest-debug/1010/artifact/logs-all.debug.2/1640918573898_lwt_banking_load_test.py%3A%3ATestLWTBankingLoad%3A%3Atest_bank_with_nemesis/node2.log ``` ERROR 2021-12-31 02:40:56,160 [shard 0] mutation_reader - shard_reader::close(): failed to stop reader on shard 1: seastar::named_semaphore_timed_out (Semaphore timed out: _system_read_concurrency_sem) ``` Fixes #9865. Signed-off-by: Benny Halevy Message-Id: <20220102124636.2791544-1-bhalevy@scylladb.com> --- mutation_reader.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mutation_reader.cc b/mutation_reader.cc index 90fdfc2ee5..f5b0f59093 100644 --- a/mutation_reader.cc +++ b/mutation_reader.cc @@ -1645,11 +1645,15 @@ future<> shard_reader::close() noexcept { co_return; } - try { - if (_read_ahead) { + if (_read_ahead) { + try { co_await *std::exchange(_read_ahead, std::nullopt); + } catch (...) { + mrlog.warn("shard_reader::close(): read_ahead on shard {} failed: {}", _shard, std::current_exception()); } + } + try { co_await smp::submit_to(_shard, [this] { auto irh = std::move(*_reader).inactive_read_handle(); return with_closeable(flat_mutation_reader(_reader.release()), [this] (flat_mutation_reader& reader) mutable {