Skip to content
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

Ignore prevote if leader lease is still valid. #366

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhangh43
Copy link

Suppose a raft group ng0 consists of three nodes(A(localhost:8001),
B(localhost:8011), C(localhost:8021)), timeline is as follows: T1: A is elected
as the leader of group ng0. term 2. T2: Restart B. T3: B start prevote for
ng0, with log message node ng0:127.0.0.1:8011 term 2 start pre_vote T4: B got
prevote grant ack from A with log message node ng0:127.0.0.1:8011:1 received
PreVoteResponse from 127.0.0.1:8001:0 term 2 granted 1 rejected_by_lease 0
disrupted 1 T5: B start to vote. T6: B got vote grant ack from A. node
ng0:127.0.0.1:8011:1 received RequestVoteResponse from 127.0.0.1:8001:0 term 3
granted 1 rejected_by_lease 0 disrupted 1 T7: B got vote reject from C. node
ng0:127.0.0.1:8011:1 received RequestVoteResponse from 127.0.0.1:8021:0 term 2
granted 0 rejected_by_lease 1 disrupted 0 T8: B become the leader of ng0 with
term 3.

It's a bug that old leader A will accept the prevote and vote from reboot node B

Suppose a raft group ng0 consists of three nodes(A(localhost:8001),
B(localhost:8011), C(localhost:8021)), timeline is as follows: T1: A is elected
as the leader of group ng0. term 2.  T2: Restart B.  T3: B start prevote for
ng0, with log message node ng0:127.0.0.1:8011 term 2 start pre_vote T4: B got
prevote grant ack from A with log message node ng0:127.0.0.1:8011:1 received
PreVoteResponse from 127.0.0.1:8001:0 term 2 granted 1 rejected_by_lease 0
disrupted 1 T5: B start to vote.  T6: B got vote grant ack from A. node
ng0:127.0.0.1:8011:1 received RequestVoteResponse from 127.0.0.1:8001:0 term 3
granted 1 rejected_by_lease 0 disrupted 1 T7: B got vote reject from C. node
ng0:127.0.0.1:8011:1 received RequestVoteResponse from 127.0.0.1:8021:0 term 2
granted 0 rejected_by_lease 1 disrupted 0 T8: B become the leader of ng0 with
term 3.

It's a bug that old leader A will accept the prevote and vote from reboot node B
@zhangh43
Copy link
Author

fixes #365
@PFZheng PR based on your comment, please help to review.

@zhangh43
Copy link
Author

zhangh43 commented Aug 3, 2022

@PFZheng Could you please help to review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant