direct_fd: do not ping self

No need to ping self in direct failure detector. This is confusing
during debugging and adds extra overhead.

Fixes #14388
This commit is contained in:
Konstantin Osipov
2023-07-06 21:05:39 +03:00
parent 50140980ac
commit ff41ea86b6
2 changed files with 12 additions and 3 deletions

View File

@@ -112,7 +112,10 @@ public:
_address_map.set_nonexpiring(addr.id);
// Notify the direct failure detector that it should track
// (or liveness of a specific raft server id.
_direct_fd.add_endpoint(addr.id.id);
if (addr != _my_id) {
// No need to ping self to know it's alive
_direct_fd.add_endpoint(addr.id.id);
}
}
for (const auto& addr: del) {
// RPC 'send' may yield before resolving IP address,

View File

@@ -27,8 +27,14 @@ logging::logger rslog("raft_group_registry");
class direct_fd_proxy : public raft::failure_detector, public direct_failure_detector::listener {
std::unordered_set<raft::server_id> _alive_set;
raft::server_id _my_id;
public:
direct_fd_proxy(raft::server_id my_id)
: _my_id(my_id)
{
}
future<> mark_alive(direct_failure_detector::pinger::endpoint_id id) override {
static const auto msg = "marking Raft server {} as alive for raft groups";
@@ -63,7 +69,7 @@ public:
}
bool is_alive(raft::server_id srv) override {
return _alive_set.contains(srv);
return srv == _my_id || _alive_set.contains(srv);
}
};
// }}} direct_fd_proxy
@@ -145,7 +151,7 @@ raft_group_registry::raft_group_registry(bool is_enabled,
, _gossiper_proxy(make_shared<gossiper_state_change_subscriber_proxy>(address_map))
, _address_map{address_map}
, _direct_fd(fd)
, _direct_fd_proxy(make_shared<direct_fd_proxy>())
, _direct_fd_proxy(make_shared<direct_fd_proxy>(my_id))
, _my_id(my_id)
{
}