From 115462be17ba0785417036bfdc24d582c3115d2d Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Wed, 6 Sep 2023 12:03:38 +0300 Subject: [PATCH 1/2] locator: topology: is_configured_this_node: compare host_id first Since 5d1f60439a845c1ea91fce17de35b879c8d642e0 we have this node's host_id in topology config, so it can be used to determine this node when adding it. Prepare for extending the token_metadata interface to provide host_id in update_topology. We would like to compare the host_id first to be able to distinguish this node from a node we're replacing that may have the same ip address (but different host_id). Signed-off-by: Benny Halevy --- locator/topology.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/locator/topology.cc b/locator/topology.cc index b6ffa83585..cfb6a43307 100644 --- a/locator/topology.cc +++ b/locator/topology.cc @@ -141,6 +141,9 @@ const node* topology::add_node(host_id id, const inet_address& ep, const endpoin } bool topology::is_configured_this_node(const node& n) const { + if (_cfg.this_host_id && n.host_id()) { // Selection by host_id + return _cfg.this_host_id == n.host_id(); + } if (_cfg.this_endpoint != inet_address()) { // Selection by endpoint return _cfg.this_endpoint == n.endpoint();; } From 574c7e349a2f6b7fb8d4bbe8eb63a2ac0b11de45 Mon Sep 17 00:00:00 2001 From: Benny Halevy Date: Wed, 6 Sep 2023 12:05:49 +0300 Subject: [PATCH 2/2] locator: topology: is_configured_this_node: delete spurious semicolumn Signed-off-by: Benny Halevy --- locator/topology.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locator/topology.cc b/locator/topology.cc index cfb6a43307..08457a0882 100644 --- a/locator/topology.cc +++ b/locator/topology.cc @@ -145,7 +145,7 @@ bool topology::is_configured_this_node(const node& n) const { return _cfg.this_host_id == n.host_id(); } if (_cfg.this_endpoint != inet_address()) { // Selection by endpoint - return _cfg.this_endpoint == n.endpoint();; + return _cfg.this_endpoint == n.endpoint(); } return false; // No selection; }