Skip to content

Commit

Permalink
[fix][sdk] Adjusting the retryTimes for REQUEST_FULL errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wt0530 authored and ketor committed Apr 26, 2024
1 parent 50eb368 commit ee2709d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public <REQ extends Request, RES extends Response> RES call(
Map<String, Integer> errMsgs = new HashMap<>();
String methodName = method.getFullMethodName();
REQ lastRequest = null;
boolean specialRetry = true;
while (retry-- > 0) {
try {
if (channel == null) {
Expand Down Expand Up @@ -104,6 +105,10 @@ public <REQ extends Request, RES extends Response> RES call(
if (errCode == Errno.ERAFT_NOTLEADER.number) {
channel = updateChannel(channel, requestId);
} else {
if (errCode == Errno.EREQUEST_FULL.number && specialRetry) {
retry = 3600;
specialRetry = false;
}
waitRetry();
}
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.dingodb.sdk.service.connector;

import io.dingodb.error.ErrorOuterClass;
import io.dingodb.sdk.common.DingoClientException;
import io.dingodb.sdk.common.DingoClientException.InvalidRouteTableException;
import io.dingodb.sdk.common.DingoClientException.RequestErrorException;
Expand Down Expand Up @@ -181,6 +182,7 @@ public <R> Response<R> exec(

S stub = null;
boolean connected = false;
boolean specialRetry = true;
Map<String, Integer> errMsgs = new HashMap<>();

while (retryTimes-- > 0) {
Expand All @@ -202,6 +204,10 @@ public <R> Response<R> exec(
case RETRY:
errorLog(name, authority, error, RETRY);
LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(1));
if (errCode == ErrorOuterClass.Errno.EREQUEST_FULL_VALUE && specialRetry) {
retryTimes = 3600;
specialRetry = false;
}
refresh(stub);
continue;
case FAILED:
Expand Down

0 comments on commit ee2709d

Please sign in to comment.