-
Notifications
You must be signed in to change notification settings - Fork 408
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
add committed index in Progress #366
Conversation
Signed-off-by: accelsao <[email protected]>
I think my test_case is useless.. |
Signed-off-by: accelsao <[email protected]>
Signed-off-by: accelsao <[email protected]>
error |
Signed-off-by: accelsao <[email protected]>
src/progress/mod.rs
Outdated
@@ -119,6 +123,7 @@ impl Progress { | |||
self.recent_active = false; | |||
debug_assert!(self.ins.cap() != 0); | |||
self.ins.reset(); | |||
self.committed_index = 0 |
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.
Seems unnecessary to reset.
@@ -212,6 +212,121 @@ fn test_progress_update() { | |||
} | |||
} | |||
|
|||
#[test] | |||
fn test_progress_committed() { |
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 think you can use Network
to test the commit index change. It should validate following case:
- Log rejection should not change commit index
- Successfully Append should update commit index
- Heartbeat should update commit index
- Commit index won't step backward.
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 still do not know when will we get the smaller commit index
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.
For example, leader sends two MsgAppend
to follower and gets MsgAppendResponse
in reverse order.
Signed-off-by: accelsao <[email protected]>
Signed-off-by: accelsao <[email protected]>
Signed-off-by: accelsao <[email protected]>
Signed-off-by: accelsao <[email protected]>
Signed-off-by: accelsao <[email protected]>
|
||
nt.send(vec![msg_append_response.clone()]); | ||
|
||
assert_eq!(nt.peers[&1].prs().get(2).unwrap().committed_index, 10); |
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.
This seems a bug.
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.
shouldnt that commiitted index is update as 10?
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.
If leader doesn't have log 10, it shouldn't commit to 10. Giving that raft-rs doesn't take much effort in byzantine fault tolerant, I think remove the case is OK for now.
Signed-off-by: accelsao <[email protected]>
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.
Thanks for your contributions!
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.
Rest LGTM
Signed-off-by: accelsao <[email protected]>
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.
One more little comment
Signed-off-by: accelsao <[email protected]>
Close #325
Signed-off-by: accelsao [email protected]