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.
This commit is contained in:
Asias He
2022-11-09 14:24:42 +08:00
parent a396c27efc
commit f2ca790883

View File

@@ -420,8 +420,8 @@ future<> token_metadata_impl::update_normal_tokens(std::unordered_set<token> 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;