Skip to content

Commit

Permalink
Merge pull request redpanda-data#23055 from mmaslankaprv/fix-assert-h…
Browse files Browse the repository at this point in the history
…b-mgr

r/hb_mgr: check if current replica is a leader when collecting hbeats
  • Loading branch information
mmaslankaprv authored Aug 26, 2024
2 parents 177b7ed + 0d22322 commit 7bc9243
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/v/raft/heartbeat_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ heartbeat_manager::requests_for_range() {
r->_fstats.end(),
[this, r, last_heartbeat, &pending_beats, &reconnect_nodes](
follower_stats::value_type& p) {
// we need to check again as the leadership might have been lost
// while we yield.
if (!r->is_elected_leader()) {
return;
}

auto& [id, follower_metadata] = p;
if (
follower_metadata.last_received_reply_timestamp
Expand Down

0 comments on commit 7bc9243

Please sign in to comment.