-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
raft: become_pre_candidate resets votes #83
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
LGTM |
Please also port the tests from etcd-io/etcd#8346 |
ping @Hoverbear |
2193ca3
to
0a8d736
Compare
@BusyJay PTAL. :) |
tests/cases/test_raft.rs
Outdated
); | ||
|
||
// check state | ||
assert_eq!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why Candidate here? not PreCandidate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/cases/test_raft.rs
Outdated
// election in next round. | ||
#[test] | ||
fn test_prevote_with_split_vote() { | ||
let bootstrap = |id| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use new_test_raft_with_prevote
?
tests/cases/test_raft.rs
Outdated
// check whether the term values are expected | ||
assert_eq!( | ||
network.peers[&2].term, 3, | ||
"peer 2 term: {:?}, want {:?}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default error message is quite informative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I will change it here, just changed it in #84.
Currently we don't reset the votes in
become_pre_candidate
when etcd does.This PR resolves this.