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

Rules for servers #1

Open
jiange91 opened this issue Sep 21, 2021 · 1 comment
Open

Rules for servers #1

jiange91 opened this issue Sep 21, 2021 · 1 comment

Comments

@jiange91
Copy link

if reply.Term > rf.currentTerm {
rf.stepDownToFollower(args.Term)
rf.persist()
return
}

Hi, Thanks for the excellent work. I have trouble understanding this block of codes. According to the paper, If RPC request or response contains term T > currentTerm, we set currentTerm = T and convert to follower. Then why using args.Term when converting to follower instead of reply.Term

@MStreet3
Copy link

MStreet3 commented Oct 26, 2021

a follower should not change the state of a candidate, it should only deny it a vote and tell it the higher term.

if a candidate receives a higher term in a RequestVoteReply, it will end its candidacy, step back to follower and keep its faulty term.

the leader will make the follower update its term when the follower handles an AppendEntries request.

if args.Term > rf.currentTerm {
rf.stepDownToFollower(args.Term)
}

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

No branches or pull requests

2 participants