-
Notifications
You must be signed in to change notification settings - Fork 727
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
Add max wait count for transfer leader operator. #147
Add max wait count for transfer leader operator. #147
Conversation
why not handling directly in LeaderTransfer? |
491ff11
to
3132e46
Compare
@siddontang Agreed, PTAL. |
@@ -176,6 +176,8 @@ func (co *ChangePeerOperator) Do(region *metapb.Region, leader *metapb.Peer) (bo | |||
|
|||
// TransferLeaderOperator is used to do leader transfer. | |||
type TransferLeaderOperator struct { | |||
mustSuc bool |
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.
s/mustSuc/mustSuccess/ ?
LGTM |
LGTM |
@shenli @siddontang |
newLeader: newLeader, | ||
oldLeader: oldLeader, | ||
newLeader: newLeader, | ||
count: 0, |
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.
The default value of count is already zero.
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.
Yes, it is a variable like index, we should update it in Do function.
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.
count
and maxWaitCount
confuse me.
you can initialize count as waitCount and then use lto.count < 0 lt.count--
to check.
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.
Seems not, we must store the origin maxWaitCount
to make sure the first time we return the transfer leader response.
If we only use count
, then we cannot distinct it.
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.
Got it.
LGTM |
* fix watch keyspace test case Signed-off-by: ystaticy <y_static_y@sina.com>
No description provided.