Check pending conf change before campaign#225
Conversation
|
I think we should contribute to etcd later. |
|
PTAL @xiang90 |
|
|
||
| /// Tests if unapplied conf change is checked before campaign. | ||
| #[test] | ||
| fn test_conf_change_check_before_campaign() { |
There was a problem hiding this comment.
if we don't call self.hub(true), the test can fail?
There was a problem hiding this comment.
Yes. The case was written before the fix, and it failed.
|
Seems criterion's API is broken. @Hoverbear Would you like to take a look? |
|
seem some failed tests were not caused by criterion API changes. |
|
@siddontang can you name some? I can't find them. |
|
|
Those tests are expected to panic. They are wrapped with UnwindSafe. |
src/raft.rs
Outdated
| ); | ||
| }); | ||
| let n = self.num_pending_conf(&ents); | ||
| if n != 0 && self.raft_log.committed > self.raft_log.applied { |
There was a problem hiding this comment.
If there is a pending snapshot, what will raft_log.applied be?
There was a problem hiding this comment.
In this case I think raft_log.applied must be less than snapshot.index, so I think only n != 0 is ok here.
There was a problem hiding this comment.
raft_log.applied can be any value less than the snapshot index.
|
LGTM. |
* Check pending conf change before campaign (#225) Fix #221. * Add more convenient lite-weight interfaces (#227) This PR introduces two simple and lite weight interfaces: - ping to trigger heartbeats without ticking, - status_ref to borrow the progress set instead of cloning. * *: bump to 0.4.2 (#228) * Bump to v0.4.3 (#231) * raft: leader respond to learner read index message (#220) Signed-off-by: nolouch <nolouch@gmail.com> * Bump to v0.4.3 Signed-off-by: Neil Shen <overvenus@gmail.com> * Request snapshot (#243) Signed-off-by: Neil Shen <overvenus@gmail.com> * fix tests * cargo fmt * address comments.
Fix #221.
This is a fix for 0.4.x, I will do the fix for master later.