+ auto units = co_await get_units(lock, 1);
+
slogger.debug("endpoint={}/{} handle_state_normal: permit_id={}", endpoint, host_id, pid);
auto tokens = get_tokens_for(endpoint);
@@ -2325,20 +2328,12 @@ future<> storage_service::handle_state_normal(inet_address endpoint, locator::ho
// Old node in replace-with-same-IP scenario.
std::optional<locator::host_id> replaced_id;
- auto ips = _gossiper.get_nodes_with_host_id(host_id);
+ auto id_to_ip_map = co_await get_host_id_to_ip_map();
std::optional<inet_address> existing;
if (tmptr->get_topology().find_node(host_id)) {
- // If node is not in the topology there is no existing address
- // If there are two addresses for the same id the "other" one is existing
- // If there is only one it is existing
- if (ips.size() == 2) {
- if (ips.erase(endpoint) == 0) {
- on_internal_error(slogger, fmt::format("Gossiper has two ips {} for host id {} but none of them is {}", ips, endpoint, host_id));
- }
- }
- existing = *ips.begin();
+ existing = id_to_ip_map.contains(host_id) ? id_to_ip_map[host_id] : endpoint;