storage_service: excise: update new token_metadata

excise is called from handle_state_left, the endpoint
may have already been removed from tm by then -
test_raft_upgrade_majority_loss fails if we use
unconditional tmptr->get_new()->get_host_id
instead of get_host_id_if_known
This commit is contained in:
Petr Gusev
2023-10-22 14:01:20 +04:00
parent 23811486d8
commit fde20bddc0

View File

@@ -6022,6 +6022,10 @@ future<> storage_service::excise(std::unordered_set<token> tokens, inet_address
auto tmptr = co_await get_mutable_token_metadata_ptr();
tmptr->remove_endpoint(endpoint);
tmptr->remove_bootstrap_tokens(tokens);
if (const auto host_id = tmptr->get_new()->get_host_id_if_known(endpoint); host_id) {
tmptr->get_new()->remove_endpoint(*host_id);
}
tmptr->get_new()->remove_bootstrap_tokens(tokens);
co_await update_topology_change_info(tmptr, ::format("excise {}", endpoint));
co_await replicate_to_all_cores(std::move(tmptr));