From d1bce3651b3095d3577eaad64ba5d108b4019df1 Mon Sep 17 00:00:00 2001 From: Petr Gusev Date: Fri, 5 Jan 2024 19:09:39 +0400 Subject: [PATCH] storage_service: sync_raft_topology_nodes: rename extract process_left_node and process_transition_node --- service/storage_service.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index 0f1ce75de0..6613c5edc7 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -392,7 +392,7 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm tmptr->update_host_id(id, ip); }; - for (const auto& id: _topology_state_machine._topology.left_nodes) { + auto process_left_node = [&] (raft::server_id id) -> future<> { auto ip = co_await id2ip(id); if (_gossiper.get_live_members().contains(ip) || _gossiper.get_unreachable_members().contains(ip)) { co_await remove_endpoint(ip, gms::null_permit_id); @@ -404,6 +404,10 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm // // However if we do that, we need to also implement unbanning a node and do it if `removenode` is aborted. co_await _messaging.local().ban_host(locator::host_id{id.uuid()}); + }; + + for (const auto& id: _topology_state_machine._topology.left_nodes) { + co_await process_left_node(id); } auto process_normal_node = [&] (raft::server_id id, const replica_state& rs) -> future<> { @@ -439,7 +443,7 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm co_await process_normal_node(id, rs); } - for (const auto& [id, rs]: _topology_state_machine._topology.transition_nodes) { + auto process_transition_node = [&](raft::server_id id, const replica_state& rs) -> future<> { locator::host_id host_id{id.uuid()}; auto ip = co_await id2ip(id); @@ -509,6 +513,10 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm default: on_fatal_internal_error(slogger, ::format("Unexpected state {} for node {}", rs.state, id)); } + }; + + for (const auto& [id, rs]: _topology_state_machine._topology.transition_nodes) { + co_await process_transition_node(id, rs); } }