From 88a682e119bd155ba238851ddb3d2716f8938e55 Mon Sep 17 00:00:00 2001 From: Alexey Zatelepin Date: Fri, 25 Oct 2024 13:34:02 +0200 Subject: [PATCH] raft: ignore heartbeat replies from unexpected node ids Usually this is a new node replying to heartbeats addressed to the corresponding ghost node. (cherry picked from commit 1c23c3566c317316bc7e46b69f41bd137c395e5e) --- src/v/raft/heartbeat_manager.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/v/raft/heartbeat_manager.cc b/src/v/raft/heartbeat_manager.cc index 34b6f77ee31e7..45b8d82bc6ada 100644 --- a/src/v/raft/heartbeat_manager.cc +++ b/src/v/raft/heartbeat_manager.cc @@ -340,6 +340,17 @@ void heartbeat_manager::process_reply( return; } auto& reply = r.value(); + + if (reply.source() != n) { + vlog( + raftlog.warn, + "got heartbeat reply from a different node id {} (expected {}), " + "ignoring", + reply.source(), + n); + return; + } + reply.for_each_lw_reply([this, n, target = reply.target(), &groups]( group_id group, reply_result result) { auto it = _consensus_groups.find(group);