From 42eaf6d9d421027a1748fa28ed2c22a8e79a1dbe Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 19 May 2026 18:22:35 +0300 Subject: [PATCH 1/3] streaming: Use inject_parameter() for order_sstables_for_streaming Replace the verbose enter() + get_injection_parameters() + manual map lookup pattern with a single inject_parameter() call. This API combines the enabled check and typed parameter extraction in one step, making the code more concise and readable. Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- streaming/stream_blob.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/streaming/stream_blob.cc b/streaming/stream_blob.cc index 639cd0fab6..7e9758a757 100644 --- a/streaming/stream_blob.cc +++ b/streaming/stream_blob.cc @@ -762,18 +762,15 @@ future tablet_stream_files_handler(replica::database& db, } else { auto sstables = co_await table.take_storage_snapshot(req.range); co_await utils::get_local_injector().inject("wait_before_tablet_stream_files_after_snapshot", utils::wait_for_message(std::chrono::seconds(60))); - co_await utils::get_local_injector().inject("order_sstables_for_streaming", [&sstables] (auto& handler) -> future<> { - if (sstables.size() == 3) { - // make sure the sstables are ordered so that the sstable containing shadowed data is streamed last - const std::string_view shadowed_file = handler.template get("shadowed_file").value(); - for (int index: {0, 1}) { - if (sstables[index].sst->component_basename(component_type::Data) == shadowed_file) { - std::swap(sstables[index], sstables[2]); - } + if (auto shadowed_file = utils::get_local_injector().inject_parameter("order_sstables_for_streaming", "shadowed_file"); + shadowed_file && sstables.size() == 3) { + // make sure the sstables are ordered so that the sstable containing shadowed data is streamed last + for (int index: {0, 1}) { + if (sstables[index].sst->component_basename(component_type::Data) == *shadowed_file) { + std::swap(sstables[index], sstables[2]); } } - return make_ready_future<>(); - }); + } auto& sst_gen = table.get_sstable_generation_generator(); From 1fd4fc906b4835a943d8b6c66cee1e1221bb1f12 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 19 May 2026 18:22:53 +0300 Subject: [PATCH 2/3] sstables: Use inject_parameter() for mx reader fill buffer timeout Replace the enter() + get_injection_parameters() + map subscript pattern with inject_parameter() which returns an optional and naturally serves as both the enabled check and parameter extraction. Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- sstables/mx/reader.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sstables/mx/reader.cc b/sstables/mx/reader.cc index 8fcd41910b..01c07e1fed 100644 --- a/sstables/mx/reader.cc +++ b/sstables/mx/reader.cc @@ -1734,11 +1734,10 @@ public: }); } return do_until([this] { return is_end_of_stream() || is_buffer_full(); }, [this] { - if (utils::get_local_injector().enter("sstables_mx_reader_fill_buffer_timeout")) { - const sstring table_name = utils::get_local_injector().get_injection_parameters("sstables_mx_reader_fill_buffer_timeout")["table"]; - const sstring this_table_name = format("{}.{}", _schema->ks_name(), _schema->cf_name()); + if (auto table_name = utils::get_local_injector().inject_parameter("sstables_mx_reader_fill_buffer_timeout", "table"); table_name) { + const auto this_table_name = format("{}.{}", _schema->ks_name(), _schema->cf_name()); // Repeat the sleep until the permit is aborted due to timeout. - if (table_name == this_table_name && !get_abort_exception()) { + if (*table_name == this_table_name && !get_abort_exception()) { return seastar::sleep(std::chrono::milliseconds(10)); } } From c23b086400053ca5ec700b8202fd1b4f55adb61a Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 19 May 2026 18:23:11 +0300 Subject: [PATCH 3/3] test: Use inject_parameter() in row_cache_test Replace get_injection_parameters().contains() with inject_parameter() for polling the "suspended" signal. The inject_parameter() API is more appropriate for checking a single parameter and reduces the usage of the lower-level get_injection_parameters() bulk accessor. Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- test/boost/row_cache_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/boost/row_cache_test.cc b/test/boost/row_cache_test.cc index efd8e032ac..d9d66e60e1 100644 --- a/test/boost/row_cache_test.cc +++ b/test/boost/row_cache_test.cc @@ -5355,7 +5355,7 @@ future<> test_cache_tombstone_gc_overlap_checks(apply_delete_fn apply_delete) { _fut = db.flush(sstring(keyspace_name), sstring(table_name)); - while (!err_inj.get_injection_parameters(injection_point_name).contains("suspended")) { + while (!err_inj.inject_parameter(injection_point_name, "suspended")) { sleep(1s).get(); } }