make configuration change effective on received#202
make configuration change effective on received#202hicqu wants to merge 30 commits intotikv:masterfrom
Conversation
|
@hicqu Can you make the CI pass? |
|
PTAL @BusyJay @Hoverbear @nolouch thank you! |
|
PTAL again, thank you. @Hoverbear @BusyJay |
|
|
@Hoverbear it doesn't matter. I was waiting for #214 exactly. Could you take a look again? Thanks! |
|
@hicqu You have a clippy lint fail :( |
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
| let mut conf_change = ConfChange::default(); | ||
| conf_change.merge_from_bytes(&e.data).unwrap(); | ||
| raw_node.apply_conf_change(&conf_change).ok(); | ||
| if raw_node.propose_conf_change(vec![], cc).is_ok() { |
| assert_eq!(nt.peers[&1].raft_log.committed, 7); | ||
| assert_eq!(nt.peers[&2].raft_log.committed, 7); | ||
| assert_eq!(nt.peers[&3].raft_log.committed, 7); | ||
| assert_eq!(nt.peers[&3].raft_log.committed, 5); |
There was a problem hiding this comment.
This shows a problem that a node will not get notified that it's removed.
Signed-off-by: qupeng <qupeng@pingcap.com>
|
Bugs described in https://groups.google.com/forum/#!msg/raft-dev/t4xj6dJTP6E/d2D9LrWRza8J is not addressed in this PR. |
fix a bug about single node membership change Signed-off-by: qupeng <qupeng@pingcap.com>
fix all test cases Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
src/progress/progress_set.rs
Outdated
| next_configuration: Option<Configuration>, | ||
|
|
||
| /// Uncommitted removed progresses with indices, which must be monotonically increasing. | ||
| pub(crate) uncommitted_removes: Vec<(u64, Vec<u64>)>, |
Signed-off-by: qupeng <qupeng@pingcap.com>
1517451 to
335e64a
Compare
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
| assert!( | ||
| check_membership_change_configuration((vec![1], vec![]), (vec![], vec![]),).is_err() | ||
| ) | ||
| assert!(check_membership_change_configuration((vec![1], vec![]), (vec![], vec![]),).is_ok()) |
There was a problem hiding this comment.
It's because currently an empty configuration is allowed as target. Do you think we need to ban it? @Hoverbear
There was a problem hiding this comment.
I'm not really sure it's a valid state.
There was a problem hiding this comment.
I guess it's valid means there is a machanism to remove all peers from a Raft group, although TiKV doesn't need it.
Signed-off-by: qupeng <qupeng@pingcap.com>
src/storage.rs
Outdated
| if snap.get_metadata().index < request_index { | ||
| // NOTE: the logic is only for tests. | ||
| snap.mut_metadata().index = request_index; | ||
| snap.mut_metadata().conf_state_index = request_index; |
There was a problem hiding this comment.
This is confusing. What if there are conf change between conf_state_index and request_index?
src/raw_node.rs
Outdated
| ..Default::default() | ||
| }; | ||
| if let Some(e) = rd.entries.first() { | ||
| for i in (0..raft.conf_states().len()).rev() { |
There was a problem hiding this comment.
Why not use Iterator::find? It seems more understandable.
There was a problem hiding this comment.
Seems it's better to find it from tail to head because there could be many unapplied entries in conf_states.
There was a problem hiding this comment.
You mean entries.iter().rev().position()?
src/raw_node.rs
Outdated
| if raft.conf_states()[i].index >= e.index { | ||
| continue; | ||
| } | ||
| if i < raft.conf_states().len() { |
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
Signed-off-by: qupeng <qupeng@pingcap.com>
|
Close. Need to find other solutions for etcd-io/etcd#11284. |
Make configuration changes effective on received.
Some test cases about membership change are removed:
Because now these API are removed.
They are covered by minority_followers_halt.