Skip to content

Commit

Permalink
unify default backoffer in tryUpdateLeader
Browse files Browse the repository at this point in the history
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
  • Loading branch information
iosmanthus committed Jul 27, 2022
1 parent 92494a7 commit 95f9b92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/tikv/common/PDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,9 @@ && createFollowerClientWrapper(backOffer, followerUrlStr, leaderUrlStr)) {

public void tryUpdateLeader() {
for (URI url : this.pdAddrs) {
BackOffer backOffer = defaultBackOffer();
// since resp is null, we need update leader's address by walking through all pd server.
GetMembersResponse resp = getMembers(defaultBackOffer(), url);
GetMembersResponse resp = getMembers(backOffer, url);
if (resp == null) {
continue;
}
Expand All @@ -595,8 +596,7 @@ public void tryUpdateLeader() {
leaderUrlStr = uriToAddr(addrToUri(leaderUrlStr));

// If leader is not change but becomes available, we can cancel follower forward.
if (checkHealth(defaultBackOffer(), leaderUrlStr, hostMapping)
&& trySwitchLeader(leaderUrlStr)) {
if (checkHealth(backOffer, leaderUrlStr, hostMapping) && trySwitchLeader(leaderUrlStr)) {
if (!urls.equals(this.pdAddrs)) {
tryUpdateMembers(urls);
}
Expand Down

0 comments on commit 95f9b92

Please sign in to comment.