From dffb266b792ca3eb00d5057435c1cf8d4f0761a3 Mon Sep 17 00:00:00 2001 From: Piotr Smaron Date: Wed, 15 Apr 2026 15:42:36 +0200 Subject: [PATCH] storage_service: fix shard-0 forwarding in REST helpers get_ownership() and abort_topology_request() forward work to shard 0 via container().invoke_on(0, ...) but the lambda captured 'this' and accessed members through it instead of through the shard-0 'ss' parameter. This means the lambda used the caller-shard's instance, defeating the purpose of the forwarding. Use the 'ss' parameter consistently so the operations run against the correct shard-0 state. --- service/storage_service.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index 039f0182e0..6b264b8e04 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -2431,7 +2431,7 @@ storage_service::prepare_replacement_info(std::unordered_set } future> storage_service::get_ownership() { - return run_with_no_api_lock([this] (storage_service& ss) { + return run_with_no_api_lock([] (storage_service& ss) { const auto& tm = ss.get_token_metadata(); auto token_map = dht::token::describe_ownership(tm.sorted_tokens()); // describeOwnership returns tokens in an unspecified order, let's re-order them @@ -2439,7 +2439,7 @@ future> storage_service::get_ownership() { for (auto entry : token_map) { locator::host_id id = tm.get_endpoint(entry.first).value(); auto token_ownership = entry.second; - ownership[_address_map.get(id)] += token_ownership; + ownership[ss._address_map.get(id)] += token_ownership; } return ownership; }); @@ -3094,8 +3094,8 @@ future storage_service::wait_for_topology_request_completion(utils::UUI } future<> storage_service::abort_topology_request(utils::UUID request_id) { - co_await container().invoke_on(0, [request_id, this] (storage_service& ss) { - return _topology_state_machine.abort_request(*ss._group0, ss._group0_as, ss._feature_service, request_id); + co_await container().invoke_on(0, [request_id] (storage_service& ss) { + return ss._topology_state_machine.abort_request(*ss._group0, ss._group0_as, ss._feature_service, request_id); }); }