From 7943db9844eb759e4e8772764be871663c29dcb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Thu, 3 Apr 2025 10:29:22 -0400 Subject: [PATCH] replica/table: add error injection to memtable post-flush phase After the memtable was flushed to disk, but before it is merged to cache. The injection point will only active for the table specified in the "table_name" injection parameter. (cherry picked from commit 6c1f6427b354a88fb2549dca8a8ee3fe6d9e165f) --- replica/table.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/replica/table.cc b/replica/table.cc index ec5dcae728..efcdecca0d 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -1657,6 +1657,17 @@ table::try_flush_memtable_to_sstable(compaction_group& cg, lw_shared_ptr future<> { + const auto this_table_name = format("{}.{}", _schema->ks_name(), _schema->cf_name()); + if (this_table_name == handler.get("table_name")) { + tlogger.info("error injection handler replica_post_flush_after_update_cache: suspending flush for table {}", this_table_name); + handler.set("suspended", true); + co_await handler.wait_for_message(std::chrono::steady_clock::now() + std::chrono::minutes{5}); + tlogger.info("error injection handler replica_post_flush_after_update_cache: resuming flush for table {}", this_table_name); + } + }); + cg.memtables()->erase(old); tlogger.debug("Memtable for {}.{} replaced, into {} sstables", old->schema()->ks_name(), old->schema()->cf_name(), newtabs.size()); co_return;