|
3 | 3 | import io.dingodb.sdk.common.DingoClientException.ExhaustedRetryException; |
4 | 4 | import io.dingodb.sdk.common.DingoClientException.InvalidRouteTableException; |
5 | 5 | import io.dingodb.sdk.common.DingoClientException.RequestErrorException; |
| 6 | +import io.dingodb.sdk.common.utils.ErrorCodeUtils; |
6 | 7 | import io.dingodb.sdk.service.JsonMessageUtils; |
7 | 8 | import io.dingodb.sdk.service.Caller; |
8 | 9 | import io.dingodb.sdk.service.ChannelProvider; |
|
12 | 13 | import io.dingodb.sdk.service.entity.Message.Response; |
13 | 14 | import io.dingodb.sdk.service.entity.error.Errno; |
14 | 15 | import io.dingodb.sdk.service.entity.error.Error; |
| 16 | +import io.dingodb.sdk.service.entity.store.TxnPrewriteResponse; |
15 | 17 | import io.grpc.CallOptions; |
16 | 18 | import io.grpc.Channel; |
17 | 19 | import io.grpc.MethodDescriptor; |
|
25 | 27 | import java.util.function.Function; |
26 | 28 |
|
27 | 29 | import static io.dingodb.sdk.common.utils.ErrorCodeUtils.errorToStrategy; |
| 30 | +import static io.dingodb.sdk.common.utils.ErrorCodeUtils.isPreWriteRequestFailed; |
28 | 31 |
|
29 | 32 | @Slf4j |
30 | 33 | public class ServiceCaller<S extends Service<S>> implements Caller<S> { |
@@ -97,7 +100,8 @@ public <REQ extends Request, RES extends Response> RES call( |
97 | 100 | channel.authority() + ">>" + error.getErrmsg(), (k, v) -> v == null ? 1 : v + 1 |
98 | 101 | ); |
99 | 102 | switch (handler.onErrStrategy( |
100 | | - errorToStrategy(errCode), |
| 103 | + isPreWriteRequestFailed(errCode, (response instanceof TxnPrewriteResponse)) ? |
| 104 | + ErrorCodeUtils.Strategy.FAILED : errorToStrategy(errCode), |
101 | 105 | this.retry, retry, request, response, options, channel.authority(), requestId |
102 | 106 | )) { |
103 | 107 | case RETRY: |
|
0 commit comments