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

Fix pd retry not recovered for 60s #182

Merged
merged 4 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/tikv/common/PDClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ synchronized boolean switchLeader(List<String> leaderURLs) {
return createLeaderWrapper(leaderUrlStr);
}

private boolean createLeaderWrapper(String leaderUrlStr) {
private synchronized boolean createLeaderWrapper(String leaderUrlStr) {
try {
URI newLeader = addrToUri(leaderUrlStr);
leaderUrlStr = uriToAddr(newLeader);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public boolean handleResponseError(BackOffer backOffer, RespT resp) {
@Override
public boolean handleRequestError(BackOffer backOffer, Exception e) {
backOffer.doBackOff(BackOffFunction.BackOffFuncType.BoPDRPC, e);
client.updateLeader();
return true;
}
}
2 changes: 1 addition & 1 deletion src/test/java/org/tikv/common/PDMockServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void addGetMemberResp(GetMembersResponse r) {
@Override
public void getMembers(GetMembersRequest request, StreamObserver<GetMembersResponse> resp) {
try {
resp.onNext(getMembersResp.removeFirst().get());
resp.onNext(getMembersResp.getFirst().get());
resp.onCompleted();
} catch (Exception e) {
resp.onError(Status.INTERNAL.asRuntimeException());
Expand Down