Skip to content

lab2c #5

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

Open
wants to merge 2 commits into
base: lab2b
Choose a base branch
from
Open

lab2c #5

wants to merge 2 commits into from

Conversation

xysun
Copy link
Owner

@xysun xysun commented Mar 29, 2020

No description provided.

@@ -218,7 +249,7 @@ func (rf *Raft) RequestVote(args *RequestVoteArgs, reply *RequestVoteReply) {
rf.PrintLogs()
myLastLogIdx := len(rf.logs) - 1
myLastLog := rf.logs[myLastLogIdx]

rf.currentTerm = args.Term // to prevent lockstep (i.e. when I am a few terms behind)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

important

@@ -677,7 +721,10 @@ func (rf *Raft) heartbeatTick() {
args.PrevLogIndex = rf.commitIndex
args.PrevLogTerm = rf.logs[args.PrevLogIndex].Term

// TODO: send entries maybe
// send entries
if rf.commitIndex < len(rf.logs)-1 {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

important: to make sure previous entries are also committed

@xysun xysun added the done label Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant