From f2ca790883a5516809c5054ee06cfa973e2fc6c4 Mon Sep 17 00:00:00 2001 From: Asias He Date: Wed, 9 Nov 2022 14:24:42 +0800 Subject: [PATCH] token_metadata: Check node is part of the topology instead of the ring update_normal_tokens is the way to add a new node into the ring. We should not require a new node to already be in the ring to be able to add it to the ring. The current code works accidentally because is_member is checking if a node is in the topology We should use _topology.has_endpoint to check if a node is part of the topology explicitly. --- locator/token_metadata.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locator/token_metadata.cc b/locator/token_metadata.cc index da4e998544..999a6cb2b0 100644 --- a/locator/token_metadata.cc +++ b/locator/token_metadata.cc @@ -420,8 +420,8 @@ future<> token_metadata_impl::update_normal_tokens(std::unordered_set tok co_return; } - if (!is_member(endpoint)) { - on_internal_error(tlogger, format("token_metadata_impl: {} must be member to update normal tokens", endpoint)); + if (!_topology.has_endpoint(endpoint, topology::pending::no)) { + on_internal_error(tlogger, format("token_metadata_impl: {} must be a member of topology to update normal tokens", endpoint)); } bool should_sort_tokens = false;