raft: hide Campaign rules on applying all entries#6039
Merged
Conversation
| // Set the initial hard and soft states after performing all initialization. | ||
| rn.prevSoftSt = r.softState() | ||
| rn.prevHardSt = r.hardState() | ||
| if lastIndex == 0 { |
Contributor
Author
There was a problem hiding this comment.
@bdarnell I try to fix the rawnode impl here. We still need to persist the initial hard state if raft is node recovered from an existing state.
Contributor
|
LGTM |
Contributor
Author
|
/cc @siddontang Probably you want to port this to rust too. |
Contributor
|
@xiang90 sure, will try tomorrow. |
Contributor
Author
|
@LK4D4 Progress? |
Contributor
|
@xiang90 I updated to your PR commit and it works perfectly. |
Contributor
Author
|
@LK4D4 OK. Thanks for confirming this for me! |
Contributor
Author
|
@gyuho Do not back port this. We need to have this tested by functional testing cluster for a while. |
Contributor
|
Ok won't. Thanks! |
| func (r *raft) Step(m pb.Message) error { | ||
| if m.Type == pb.MsgHup { | ||
| if r.state != StateLeader { | ||
| ents, err := r.raftLog.entries(r.raftLog.applied+1, r.raftLog.committed-r.raftLog.applied) |
Contributor
There was a problem hiding this comment.
Hi @xiang90
The entries second argument is maxsize, but here seems using log count (committed - applied), not size.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #6013.
@LK4D4 can you please give this a try?
Previously we have some rules about when there are configuration changes. It is actually a little bit hard to follow for applications. Now we try to handle it internally inside raft.