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.
This commit is contained in:
Petr Gusev
2024-01-05 19:02:32 +04:00
parent 1b12f4b292
commit a508d7ffc5

View File

@@ -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);