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

raft: add handleHeartbeat #1740

Merged
merged 1 commit into from
Nov 18, 2014
Merged

raft: add handleHeartbeat #1740

merged 1 commit into from
Nov 18, 2014

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Nov 18, 2014

handleHeartbeat commits to the commit index in the message. It never decreases the
commit index of the raft state machine.

}
l.committed = tocommit
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

add a specific test for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

@yichengq
Copy link
Contributor

we need to make corresponded change at https://github.com/coreos/etcd/blob/master/raft/raft.go#L432, which handles heartbeat response before.

HardState: pb.HardState{Term: 2},
raftLog: &raftLog{committed: 0, ents: []pb.Entry{{}, {Term: 1}, {Term: 2}, {Term: 3}}},
}
sm.raftLog.commitTo(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

sm.raftLog.commitTo(commit)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do

handleHeartbeat commits to the commit index in the message. It never decreases the
commit index of the raft state machine.
@xiang90
Copy link
Contributor Author

xiang90 commented Nov 18, 2014

done. I am not going to change the heartbeat response handling logic at leader side, since we are not sure if we will add the heartbeat response back soon. We can revisit all these sort of thing when we introduce the msgHeartbeat type. Current goal is to ensure we have a clear path to support streaming.

if l.committed < tocommit {
l.committed = tocommit
}
l.commitTo(min(committed, lastnewi))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bdarnell You probably need to do a rebase due to this change. :(

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change will be a problem, actually, since I haven't really touched the commit logic. I have, however, had to do a number of non-trivial merges for changes around stableTo(). Once I finish up the snapshot stuff I'm currently working on I think my branch will be ready to merge back into the mainline.

@yichengq
Copy link
Contributor

lgtm

xiang90 added a commit that referenced this pull request Nov 18, 2014
@xiang90 xiang90 merged commit e07ef69 into etcd-io:master Nov 18, 2014
@xiang90 xiang90 deleted the handleheartbeat branch November 18, 2014 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants