From 2e7e59fb5034ea6bd4e4082b4996c29ea4439fbb Mon Sep 17 00:00:00 2001 From: Asias He Date: Tue, 26 Jun 2018 16:36:27 +0800 Subject: [PATCH] gossip: Fix tokens assignment in assassinate_endpoint The tokens vector is defined a few lines above and is needed outsie the if block. Do not redefine it again in the if block, otherwise the tokens will be empty. Found by code inspection. Fixes #3551. Message-Id: (cherry picked from commit c3b5a2ecd581fad608253fd825d90aa260a32936) --- gms/gossiper.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gms/gossiper.cc b/gms/gossiper.cc index 698beb0bbc..fb2eb9d979 100644 --- a/gms/gossiper.cc +++ b/gms/gossiper.cc @@ -984,7 +984,7 @@ future<> gossiper::assassinate_endpoint(sstring address) { logger.warn("Assassinating {} via gossip", endpoint); if (es) { auto& ss = service::get_local_storage_service(); - auto tokens = ss.get_token_metadata().get_tokens(endpoint); + tokens = ss.get_token_metadata().get_tokens(endpoint); if (tokens.empty()) { logger.warn("Unable to calculate tokens for {}. Will use a random one", address); throw std::runtime_error(sprint("Unable to calculate tokens for %s", endpoint));