Skip to content

raft: hide Campaign rules on applying all entries#6039

Merged
xiang90 merged 1 commit into
etcd-io:masterfrom
xiang90:fix_r
Jul 27, 2016
Merged

raft: hide Campaign rules on applying all entries#6039
xiang90 merged 1 commit into
etcd-io:masterfrom
xiang90:fix_r

Conversation

@xiang90
Copy link
Copy Markdown
Contributor

@xiang90 xiang90 commented Jul 25, 2016

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.

Comment thread raft/rawnode.go
// Set the initial hard and soft states after performing all initialization.
rn.prevSoftSt = r.softState()
rn.prevHardSt = r.hardState()
if lastIndex == 0 {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@bdarnell
Copy link
Copy Markdown
Contributor

LGTM

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jul 25, 2016

/cc @siddontang Probably you want to port this to rust too.

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jul 25, 2016

@xiang90 sure, will try tomorrow.

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jul 27, 2016

@LK4D4 Progress?

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented Jul 27, 2016

@xiang90 I updated to your PR commit and it works perfectly.

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jul 27, 2016

@LK4D4 OK. Thanks for confirming this for me!

@xiang90
Copy link
Copy Markdown
Contributor Author

xiang90 commented Jul 27, 2016

@gyuho Do not back port this. We need to have this tested by functional testing cluster for a while.

@xiang90 xiang90 merged commit a75688b into etcd-io:master Jul 27, 2016
@xiang90 xiang90 deleted the fix_r branch July 27, 2016 03:52
@gyuho
Copy link
Copy Markdown
Contributor

gyuho commented Jul 27, 2016

Ok won't. Thanks!

Comment thread raft/raft.go
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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xiang90

The entries second argument is maxsize, but here seems using log count (committed - applied), not size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants