Skip to content
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

return leaderTransferee at raft status #7761

Merged
merged 1 commit into from
May 31, 2017
Merged

return leaderTransferee at raft status #7761

merged 1 commit into from
May 31, 2017

Conversation

xiaoyulei
Copy link
Contributor

return leaderTransferee when get raft status

get more detail information about raft status

@xiang90
Copy link
Contributor

xiang90 commented Apr 18, 2017

Can you explain your use case to justify this additional information?

@xiaoyulei
Copy link
Contributor Author

Node A is leader, B and C is follower.
If B's logs is behind A a lot, transfer leader from A to B need more time when we set election timeout for long time. When A is transferring, it can not work. So we can know the exact state of node A if we found it not work.

@codecov-io
Copy link

codecov-io commented Apr 19, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@386374a). Click here to learn what that means.
The diff coverage is 37.5%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #7761   +/-   ##
=========================================
  Coverage          ?   75.59%           
=========================================
  Files             ?      336           
  Lines             ?    26393           
  Branches          ?        0           
=========================================
  Hits              ?    19953           
  Misses            ?     5000           
  Partials          ?     1440
Impacted Files Coverage Δ
raft/status.go 27.58% <37.5%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 386374a...44a49ff. Read the comment docs.

@xiang90
Copy link
Contributor

xiang90 commented May 9, 2017

OK. can you also add transferee into the json marshal func?

@xiaoyulei
Copy link
Contributor Author

@xiang90 sure, glad to do it.

@xiaoyulei
Copy link
Contributor Author

@xiang90 I have add transferee into json marshal, PTAL

@xiang90
Copy link
Contributor

xiang90 commented May 30, 2017

@YuleiXiao Have you checked the json output is valid? can you give me an example output?

@xiaoyulei
Copy link
Contributor Author

xiaoyulei commented May 31, 2017

@xiang90

test code:

p := make(map[uint64]Progress)
	p[2] = Progress{
		Match: 3,
		Next:  4,
		State: ProgressStateReplicate,
	}
	s := Status{
		ID: uint64(1),
		HardState: pb.HardState{
			Term:   5,
			Vote:   6,
			Commit: 7,
		},
		SoftState: SoftState{
			Lead:      1,
			RaftState: StateLeader,
		},
		Applied:        100,
		Progress:       p,
		LeadTransferee: 2,
	}

	data, _ := s.MarshalJSON()

print date and check at https://jsonlint.com/:

{
	"id": "1",
	"term": 5,
	"vote": "6",
	"commit": 7,
	"lead": "1",
	"raftState": "StateLeader",
	"applied": 100,
	"progress": {
		"2": {
			"match": 3,
			"next": 4,
			"state": "ProgressStateReplicate"
		}
	},
	"leadtransferee": "2"
}

@xiang90
Copy link
Contributor

xiang90 commented May 31, 2017

lgtm

@xiang90 xiang90 merged commit f03ed33 into etcd-io:master May 31, 2017
@xiaoyulei xiaoyulei deleted the xyl_get_transfer_leader_status branch June 1, 2017 01:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants