From fde20bddc071a26e2fb74dc6b1e078180e0625b9 Mon Sep 17 00:00:00 2001 From: Petr Gusev Date: Sun, 22 Oct 2023 14:01:20 +0400 Subject: [PATCH] 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 --- service/storage_service.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/storage_service.cc b/service/storage_service.cc index fdd6c97929..636a385a26 100644 --- a/service/storage_service.cc +++ b/service/storage_service.cc @@ -6022,6 +6022,10 @@ future<> storage_service::excise(std::unordered_set 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));