mirror of https://github.com/tikv/client-java.git
fix backoff time (#241)
This commit is contained in:
parent
798244cd9e
commit
7fe59efd4a
|
|
@ -130,9 +130,12 @@ public class RegionErrorHandler<RespT> implements ErrorHandler<RespT> {
|
||||||
BackOffFunction.BackOffFuncType.BoServerBusy,
|
BackOffFunction.BackOffFuncType.BoServerBusy,
|
||||||
new StatusRuntimeException(
|
new StatusRuntimeException(
|
||||||
Status.fromCode(Status.Code.UNAVAILABLE).withDescription(error.toString())));
|
Status.fromCode(Status.Code.UNAVAILABLE).withDescription(error.toString())));
|
||||||
|
return true;
|
||||||
|
} else if (error.hasRegionNotFound()) {
|
||||||
backOffer.doBackOff(
|
backOffer.doBackOff(
|
||||||
BackOffFunction.BackOffFuncType.BoRegionMiss, new GrpcException(error.getMessage()));
|
BackOffFunction.BackOffFuncType.BoRegionMiss, new GrpcException(error.getMessage()));
|
||||||
return true;
|
this.regionManager.onRegionStale(recv.getRegion());
|
||||||
|
return false;
|
||||||
} else if (error.hasStaleCommand()) {
|
} else if (error.hasStaleCommand()) {
|
||||||
// this error is reported from raftstore:
|
// this error is reported from raftstore:
|
||||||
// command outdated, please try later
|
// command outdated, please try later
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ public abstract class AbstractRegionStoreClient
|
||||||
}
|
}
|
||||||
if (originStore == null) {
|
if (originStore == null) {
|
||||||
originStore = targetStore;
|
originStore = targetStore;
|
||||||
if (this.targetStore.getProxyStore() != null) {
|
if (this.targetStore.getProxyStore() != null && this.timeout < conf.getForwardTimeout()) {
|
||||||
this.timeout = conf.getForwardTimeout();
|
this.timeout = conf.getForwardTimeout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,30 +86,30 @@ public class ConcreteBackOffer implements BackOffer {
|
||||||
private BackOffFunction createBackOffFunc(BackOffFunction.BackOffFuncType funcType) {
|
private BackOffFunction createBackOffFunc(BackOffFunction.BackOffFuncType funcType) {
|
||||||
BackOffFunction backOffFunction = null;
|
BackOffFunction backOffFunction = null;
|
||||||
switch (funcType) {
|
switch (funcType) {
|
||||||
case BoUpdateLeader:
|
|
||||||
backOffFunction = BackOffFunction.create(1, 10, BackOffStrategy.NoJitter);
|
|
||||||
break;
|
|
||||||
case BoTxnLockFast:
|
case BoTxnLockFast:
|
||||||
backOffFunction = BackOffFunction.create(100, 3000, BackOffStrategy.EqualJitter);
|
backOffFunction = BackOffFunction.create(100, 3000, BackOffStrategy.EqualJitter);
|
||||||
break;
|
break;
|
||||||
case BoServerBusy:
|
|
||||||
backOffFunction = BackOffFunction.create(2000, 10000, BackOffStrategy.EqualJitter);
|
|
||||||
break;
|
|
||||||
case BoRegionMiss:
|
|
||||||
backOffFunction = BackOffFunction.create(100, 500, BackOffStrategy.NoJitter);
|
|
||||||
break;
|
|
||||||
case BoTxnLock:
|
case BoTxnLock:
|
||||||
backOffFunction = BackOffFunction.create(200, 3000, BackOffStrategy.EqualJitter);
|
backOffFunction = BackOffFunction.create(200, 3000, BackOffStrategy.EqualJitter);
|
||||||
break;
|
break;
|
||||||
case BoPDRPC:
|
|
||||||
backOffFunction = BackOffFunction.create(100, 600, BackOffStrategy.EqualJitter);
|
|
||||||
break;
|
|
||||||
case BoTiKVRPC:
|
|
||||||
backOffFunction = BackOffFunction.create(100, 400, BackOffStrategy.EqualJitter);
|
|
||||||
break;
|
|
||||||
case BoTxnNotFound:
|
case BoTxnNotFound:
|
||||||
backOffFunction = BackOffFunction.create(2, 500, BackOffStrategy.NoJitter);
|
backOffFunction = BackOffFunction.create(2, 500, BackOffStrategy.NoJitter);
|
||||||
break;
|
break;
|
||||||
|
case BoServerBusy:
|
||||||
|
backOffFunction = BackOffFunction.create(40, 5120, BackOffStrategy.EqualJitter);
|
||||||
|
break;
|
||||||
|
case BoUpdateLeader:
|
||||||
|
backOffFunction = BackOffFunction.create(1, 10, BackOffStrategy.NoJitter);
|
||||||
|
break;
|
||||||
|
case BoRegionMiss:
|
||||||
|
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.NoJitter);
|
||||||
|
break;
|
||||||
|
case BoPDRPC:
|
||||||
|
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.EqualJitter);
|
||||||
|
break;
|
||||||
|
case BoTiKVRPC:
|
||||||
|
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.EqualJitter);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return backOffFunction;
|
return backOffFunction;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue