From 8545f7eedd89ea5e34a7b6e42c1931b17dfaeb07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Wed, 12 Nov 2025 15:48:41 +0200 Subject: [PATCH] service/storage_proxy: s/batch_replay_throw/storage_proxy_fail_replay_batch/ Rename to make it more explicit where the error injection happens. Also change how the error is injected, use the lambda overload instead of is_enabled(), the former leaves better trace in logs, which helps when debugging tests. --- service/storage_proxy.cc | 4 +--- test/cluster/test_batchlog_manager.py | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index 49031e813c..bdeea0d82c 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -4501,9 +4501,7 @@ future<> storage_proxy::send_hint_to_all_replicas(frozen_mutation_and_schema fm_ } future<> storage_proxy::send_batchlog_replay_to_all_replicas(utils::chunked_vector mutations, clock_type::time_point timeout) { - if (utils::get_local_injector().is_enabled("batch_replay_throw")) { - throw std::runtime_error("Skipping batch replay due to batch_replay_throw injection"); - } + utils::get_local_injector().inject("storage_proxy_fail_replay_batch", [] { throw std::runtime_error("Error injection: failing to send batch"); }); utils::chunked_vector ms = mutations | std::views::transform([] (auto&& m) { return batchlog_replay_mutation(std::move(m)); diff --git a/test/cluster/test_batchlog_manager.py b/test/cluster/test_batchlog_manager.py index 3df6c8b2f9..2e4cbcf306 100644 --- a/test/cluster/test_batchlog_manager.py +++ b/test/cluster/test_batchlog_manager.py @@ -388,7 +388,7 @@ async def test_batchlog_replay_failure_during_repair(manager: ManagerClient, rep # Once the mutations are in the batchlog, waiting to be replayed, we can disable this. await disable_injection("storage_proxy_fail_remove_from_batchlog") - await enable_injection("batch_replay_throw") + await enable_injection("storage_proxy_fail_replay_batch") # Once the table is dropped, we can resume the replay. The bug can # be triggered from now on (if it's present). await disable_injection("skip_batch_replay") @@ -404,7 +404,7 @@ async def test_batchlog_replay_failure_during_repair(manager: ManagerClient, rep await manager.api.keyspace_compaction(s1.ip_addr, ks) await manager.api.keyspace_compaction(s2.ip_addr, ks) - await disable_injection("batch_replay_throw") + await disable_injection("storage_proxy_fail_replay_batch") await s1_log.wait_for("Replaying batch", timeout=60, from_mark=s1_mark) await s1_log.wait_for("Finished replayAllFailedBatches", timeout=60, from_mark=s1_mark)