-
Notifications
You must be signed in to change notification settings - Fork 0
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
etcdctl: find leader when promoting learner #28
Conversation
find leader endpoint in the given endpoints, send member promote request to leader endpoint.
24b0337
to
285a96f
Compare
hmm, I don't have better idea to solve all the problem. I think it might just work for now. |
maybe @jpbetz has better idea? for example add a helper function in clientv3 that can make client talk to the leader directly? |
leaderEp string | ||
leaderFound bool | ||
) | ||
for _, ep := range eps { |
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.
If ctx has a deadline, loop multiple times over the endpoints until the deadline expires or a leader is found? This would reduce the odd of a leader change causing this operation to fail.
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.
Ignore if we can do a server side request foward like mentioned in #28 (comment)
Lines 289 to 294 in 636bf1c
Can we use the same approach for |
If we can forwarding use Maybe introduce an |
Thanks @jpbetz. I'll take a closer look on server side forwarding. We might want to keep the client side logic (at least for move leader) for backward compatibility reasons (when new etcdctl send move leader request to old server). |
We decided to implement server side forwarding of the member promote request. Closing this PR. |
agreed |
Background:
In #15, we decided to have client only send member promote request to leader in order to simply the implementation of learner progress check on server side.
What this PR does:
This PR partially addresses the issue of "only send member promote request to leader".
etcdctl member promote
will scan over the provided endpoints to find leader, then send promote request to leader endpoint.Remaining issue:
User can still create their own clientv3 client with random endpoint in cluster and use it to send member promote request. If the endpoint is not a leader, request will fail with error
ErrNotLeader
according to logic added in #19. But at leastetcdctl member promote
command will try to find leader endpoint.cc @gyuho @WIZARD-CXY @jpbetz