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
*: introduce confchange package #383
Conversation
The package is ported from etcd/raft/confchange. restore function is not used yet. tests will be ported after all functional codes are ported. There is a difference between raft-rs and etcd that etcd shallow clones progress set in changer, but raft-rs only use reference and record changes. It's not easy to shallow clone in rust without lifetime hack or introducing redundant containers. Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
@Fullstop000 PTAL if you have time. Thanks! |
} | ||
cfg.voters | ||
.outgoing | ||
.extend(cfg.voters.incoming.iter().cloned()); |
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.
In etcd, the behavior is clear outgoing
and copy incoming
to outgoing
.
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 check at L71 ensures that outgoing is empty. Assigning new empty map is necessary in etcd, because it uses nil map which can't be modified. But we use empty map that doesn't have the issue.
src/confchange/restore.rs
Outdated
/// TODO(tbg) it's silly that this takes a Changer. Unravel this by making sure the | ||
/// Changer only needs a ProgressMap (not a whole Tracker) at which point this can just | ||
/// take LastIndex and MaxInflight directly instead and cook up the results from that | ||
/// alone. |
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 annotation may should be updated?
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
Signed-off-by: Jay Lee <BusyJayLee@gmail.com>
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
The package is ported from etcd/raft/confchange. restore function is not
used yet. tests will be ported after all functional codes are ported.
There is a difference between raft-rs and etcd that etcd shallow clones
progress set in changer, but raft-rs only use reference and record
changes. It's not easy to shallow clone in rust without lifetime hack
or introducing redundant containers.