From a508d7ffc5f965fb1c92820293b6085f8a6c254d Mon Sep 17 00:00:00 2001 From: Petr Gusev Date: Fri, 5 Jan 2024 19:02:32 +0400 Subject: [PATCH] storage_service: sync_raft_topology_nodes: move update_topology up In this and the following commits we prepare sync_raft_topology_nodes to handle target_node parameter - the single host_id which should be updated. --- service/storage_service.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/service/storage_service.cc b/service/storage_service.cc index c00cac4565..98cf609397 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -386,6 +386,12 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm co_return *ip; }; + auto update_topology = [&] (locator::host_id id, inet_address ip, const replica_state& rs) { + tmptr->update_topology(id, locator::endpoint_dc_rack{rs.datacenter, rs.rack}, + to_topology_node_state(rs.state), rs.shard_count); + tmptr->update_host_id(id, ip); + }; + for (const auto& id: _topology_state_machine._topology.left_nodes) { auto ip = co_await id2ip(id); if (_gossiper.get_live_members().contains(ip) || _gossiper.get_unreachable_members().contains(ip)) { @@ -400,12 +406,6 @@ future<> storage_service::sync_raft_topology_nodes(mutable_token_metadata_ptr tm co_await _messaging.local().ban_host(locator::host_id{id.uuid()}); } - auto update_topology = [&] (locator::host_id id, inet_address ip, const replica_state& rs) { - tmptr->update_topology(id, locator::endpoint_dc_rack{rs.datacenter, rs.rack}, - to_topology_node_state(rs.state), rs.shard_count); - tmptr->update_host_id(id, ip); - }; - auto add_normal_node = [&] (raft::server_id id, const replica_state& rs) -> future<> { locator::host_id host_id{id.uuid()}; auto ip = co_await id2ip(id);