-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
raftstore: reject transfer leader to the recently added peers #3878
Conversation
Signed-off-by: nolouch <nolouch@gmail.com>
41cc231
to
d87203e
Compare
d87203e
to
f4ac4f6
Compare
em, can the leader know the applied index of the followers so that we can do a more accurate control? |
@siddontang Currently, the apply index can only be known by itself. If need precise control, should change it in the raft library. This is a quick fix, and the long-term solution maybe is this. |
I prefer to do a quick fix for now. And make it better later. |
Signed-off-by: nolouch <nolouch@gmail.com>
d15a8ea
to
554cc21
Compare
This still has the risk that the learner drops the transfer leader message if the learner applies too slow. /cc @BusyJay |
Yes, it does. But it should be hardly possible. |
Signed-off-by: nolouch <nolouch@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>
a30ecb5
to
c958715
Compare
Good job. |
Signed-off-by: nolouch <nolouch@gmail.com>
src/raftstore/store/fsm/peer.rs
Outdated
@@ -893,6 +893,10 @@ impl<T: Transport, C: PdClient> Store<T, C> { | |||
if p.is_leader() { | |||
p.peers_start_pending_time.push((id, now)); | |||
} | |||
// Add peer or promote the learner | |||
if !peer.get_is_learner() { |
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 only leader needs to do this.
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.
Maybe transfer From A to B then to Cnew.
Signed-off-by: nolouch <nolouch@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
Signed-off-by: nolouch <nolouch@gmail.com>
Signed-off-by: nolouch <nolouch@gmail.com>
962695f
to
95890c2
Compare
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
What have you changed? (mandatory)
The apply state not consistent with the leader, transfer leader to newly added peer probable failed . reject transfer leader to the recently added peers to prevent transferring failed.
This is a quick fix, need remove after tikv/raft-rs#144 sloved.
ref: #3819
What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
unit test.
manua test:
![deepinscreenshot_select-area_20181206131739](https://user-images.githubusercontent.com/6428910/49563276-2bae0d80-f95a-11e8-9361-6dfe653da39e.png)
master(before) vs bransh(after):
prepare: add a special hot scheduler that move hot region and transfer the leader to the newly added hot peer. run oltp test.
result: