New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raftstore: fix redundant heartbeat #3864

merged 3 commits into from Nov 30, 2018


None yet
4 participants

rleungx commented Nov 30, 2018

What have you changed? (mandatory)

This PR fixes the problem which may send redundant heartbeat to PD. If a peer is the leader, it will call heartbeat_pd, which will put the pending peer into peers_start_pending_time. And if the ConfChangeType is AddLearnerNode, it will be pushed again. So it might send two heartbeats to PD at the same time.

What are the type of the changes? (mandatory)

  • Bug fix (non-breaking change which fixes an issue)

How has this PR been tested? (mandatory)

manual tests

@rleungx rleungx added the C: Raft label Nov 30, 2018

@rleungx rleungx requested a review from hicqu Nov 30, 2018

fix the heartbeat
Signed-off-by: rleungx <>

@rleungx rleungx force-pushed the rleungx:fix-heartbeat branch from fd4f8cf to 059df3d Nov 30, 2018

if p.is_leader() {
p.peers_start_pending_time.push((peer.get_id(), now));
if !p.peers_start_pending_time.iter().any(|&(pid, _)| pid == id) {

This comment has been minimized.


BusyJay Nov 30, 2018


Seems it is always true.

tiny change
Signed-off-by: rleungx <>
add the comment
Signed-off-by: rleungx <>

This comment has been minimized.


disksing commented Nov 30, 2018

@rleungx Please cherry-pick it to release-2.1 branch.

@disksing disksing merged commit e6971e8 into tikv:master Nov 30, 2018

3 checks passed

DCO All commits are signed off!
ci/circleci: test Your tests passed on CircleCI!
jenkins-ci-tikv/build Jenkins job succeeded.

rleungx added a commit to rleungx/tikv that referenced this pull request Nov 30, 2018

raftstore: fix redundant heartbeat (tikv#3864)
* fix the heartbeat

Signed-off-by: rleungx <>

breeswish added a commit that referenced this pull request Dec 3, 2018

raftstore: fix redundant heartbeat (#3864) (#3866)
Signed-off-by: rleungx <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment