Skip to content

Commit

Permalink
raft: ignore heartbeat replies from unexpected node ids
Browse files Browse the repository at this point in the history
Usually this is a new node replying to heartbeats addressed to the
corresponding ghost node.

(cherry picked from commit 1c23c35)
  • Loading branch information
ztlpn committed Oct 28, 2024
1 parent 29996ff commit 88a682e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/v/raft/heartbeat_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 88a682e

Please sign in to comment.