-
Notifications
You must be signed in to change notification settings - Fork 400
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
implement CommittedEntries pagination #161
Conversation
I got several warnings and errors complaining about some deprecated lint names when executing
erros like below :
Probably I need some guidance about this since I'm a rust cookie ( just wrote this PR as my first shot in rust ) |
Hi @Fullstop000 I'll deal with those errors. :) Sorry about that! |
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.
Hi! Thanks so much for tacking this! We really appreciate it! 🎉
In general it LGTM, but I notice in the etcd PR (here there is a second test added. Can you explain the choice to not add this one?
@Hoverbear the second test And I find that etcd-raft has added a new config parameter |
@Fullstop000 Great catch. I think this is a more clear functionality. @hicqu can you take a look? |
I'll use the new parameter |
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.
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.
Generally LGTM, only a small lint related comment.
src/raft_log.rs
Outdated
new_entry_with_data(5, 1, data.clone()), | ||
new_entry_with_data(6, 1, data.clone()), | ||
]; | ||
let unit_msg_size = u64::from(protobuf::Message::compute_size(&new_entry_with_data( |
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.
What about &ents[0]
?
src/raw_node.rs
Outdated
// If we hit a size limit when loading CommittedEntries, clamp | ||
// our HardState.Commit to what we're actually returning. This is | ||
// also used as our cursor to resume for the next Ready. | ||
if let Some(committed_entries) = rd.committed_entries.as_ref() { |
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.
What about rd.committed_entries.as_ref().and_then(|c| c.last())
?
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.
OMG, it's really beautiful here to use functional pattern.
cfg.max_committed_size_per_ready = 1024; | ||
let storage = new_storage(); | ||
let mut raw_node = RawNode::new(&cfg, storage.clone(), vec![new_peer(1)]).unwrap(); | ||
let rd = raw_node.ready(); |
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 three lines seem unnecessary.
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.
Do you mean the 3rd line or all the lines from 121 to 123? I couldn't figure it out why the raw_node
should be removed.
tests/integration_cases/test_raft.rs
Outdated
@@ -2620,6 +2620,46 @@ fn test_leader_increase_next() { | |||
} | |||
} | |||
|
|||
#[test] | |||
fn test_send_append_pagination_with_max_size_per_msg() { |
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.
What's the purpose of this case? Maybe you can add a hook to Network
to implement a similar case with the original PR.
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.
It ensures the hard_state.commit
matches with last committed entry index in Ready
if committed_entries
overflow the max_committed_size_per_ready
.
Hi @Fullstop000 have you had a chance to see this feedback? Can I help you at all with it? |
@BusyJay @Hoverbear Sorry for the delay. Kind of busy here :( |
Hetian Zhu seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Fixes #105