[PATCH v1 04/18] gossiper: move _pending_mark_alive_endpoints to host id

2 views
Skip to first unread message

Gleb Natapov

<gleb@scylladb.com>
unread,
Mar 31, 2025, 4:35:35 AMMar 31
to scylladb-dev@googlegroups.com
Index _pending_mark_alive_endpoints map by host id instead of ip
---
gms/gossiper.hh | 2 +-
gms/gossiper.cc | 23 ++++++++++++-----------
2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/gms/gossiper.hh b/gms/gossiper.hh
index 4b4d58f3323..e1cbe967b3f 100644
--- a/gms/gossiper.hh
+++ b/gms/gossiper.hh
@@ -229,7 +229,7 @@ class gossiper : public seastar::async_sharded_service<gossiper>, public seastar
uint64_t _live_endpoints_version = 0;

/* nodes are being marked as alive */
- std::unordered_set<inet_address> _pending_mark_alive_endpoints;
+ std::unordered_set<locator::host_id> _pending_mark_alive_endpoints;

/* unreachable member set */
std::unordered_map<locator::host_id, clk::time_point> _unreachable_endpoints;
diff --git a/gms/gossiper.cc b/gms/gossiper.cc
index dfd1f2d78e9..9dfe24d8590 100644
--- a/gms/gossiper.cc
+++ b/gms/gossiper.cc
@@ -1687,28 +1687,29 @@ future<> gossiper::notify_nodes_on_up(std::unordered_set<locator::host_id> dsts)
}

void gossiper::mark_alive(inet_address addr) {
+ auto id = get_host_id(addr);
+ if (id == my_host_id()) {
+ // We are here because this node changed address and now tries to
+ // ping an old gossip entry.
+ return;
+ }
+
// Enter the _background_msg gate so stop() would wait on it
- auto inserted = _pending_mark_alive_endpoints.insert(addr).second;
+ auto inserted = _pending_mark_alive_endpoints.insert(id).second;
if (inserted) {
// The node is not in the _pending_mark_alive_endpoints
- logger.debug("Mark Node {} alive with EchoMessage", addr);
+ logger.debug("Mark Node {}/{} alive with EchoMessage", id, addr);
} else {
// We are in the progress of marking this node alive
- logger.debug("Node {} is being marked as up, ignoring duplicated mark alive operation", addr);
+ logger.debug("Node {}/{} is being marked as up, ignoring duplicated mark alive operation", id, addr);
return;
}

// unmark addr as pending on exception or after background continuation completes
- auto unmark_pending = deferred_action([this, addr, g = shared_from_this()] () noexcept {
- _pending_mark_alive_endpoints.erase(addr);
+ auto unmark_pending = deferred_action([this, id, g = shared_from_this()] () noexcept {
+ _pending_mark_alive_endpoints.erase(id);
});

- auto id = get_host_id(addr);
- if (id == my_host_id()) {
- // We are here because this node changed address and now tries to
- // ping an old gossip entry.
- return;
- }
if (_address_map.find(id) != addr) {
// We are here because id has now different ip but we
// try to ping the old one
--
2.47.1

Reply all
Reply to author
Forward
0 new messages