Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ public boolean handleRegionError(BackOffer backOffer, Errorpb.Error error) {
BackOffFunction.BackOffFuncType.BoServerBusy,
new StatusRuntimeException(
Status.fromCode(Status.Code.UNAVAILABLE).withDescription(error.toString())));
return true;
} else if (error.hasRegionNotFound()) {
backOffer.doBackOff(
BackOffFunction.BackOffFuncType.BoRegionMiss, new GrpcException(error.getMessage()));
return true;
this.regionManager.onRegionStale(recv.getRegion());
return false;
} else if (error.hasStaleCommand()) {
// this error is reported from raftstore:
// command outdated, please try later
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private boolean retryOtherStoreByProxyForward() {
}
if (originStore == null) {
originStore = targetStore;
if (this.targetStore.getProxyStore() != null) {
if (this.targetStore.getProxyStore() != null && this.timeout < conf.getForwardTimeout()) {
this.timeout = conf.getForwardTimeout();
}
}
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/tikv/common/util/ConcreteBackOffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,29 @@ public static ConcreteBackOffer create(BackOffer source) {
private BackOffFunction createBackOffFunc(BackOffFunction.BackOffFuncType funcType) {
BackOffFunction backOffFunction = null;
switch (funcType) {
case BoUpdateLeader:
backOffFunction = BackOffFunction.create(1, 10, BackOffStrategy.NoJitter);
break;
case BoTxnLockFast:
backOffFunction = BackOffFunction.create(100, 3000, BackOffStrategy.EqualJitter);
break;
case BoTxnLock:
backOffFunction = BackOffFunction.create(200, 3000, BackOffStrategy.EqualJitter);
break;
case BoTxnNotFound:
backOffFunction = BackOffFunction.create(2, 500, BackOffStrategy.NoJitter);
break;
case BoServerBusy:
backOffFunction = BackOffFunction.create(2000, 10000, BackOffStrategy.EqualJitter);
backOffFunction = BackOffFunction.create(100, 5120, BackOffStrategy.EqualJitter);
break;
case BoRegionMiss:
backOffFunction = BackOffFunction.create(100, 500, BackOffStrategy.NoJitter);
case BoUpdateLeader:
backOffFunction = BackOffFunction.create(1, 10, BackOffStrategy.NoJitter);
break;
case BoTxnLock:
backOffFunction = BackOffFunction.create(200, 3000, BackOffStrategy.EqualJitter);
case BoRegionMiss:
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.NoJitter);
break;
case BoPDRPC:
backOffFunction = BackOffFunction.create(100, 600, BackOffStrategy.EqualJitter);
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.EqualJitter);
break;
case BoTiKVRPC:
backOffFunction = BackOffFunction.create(100, 400, BackOffStrategy.EqualJitter);
break;
case BoTxnNotFound:
backOffFunction = BackOffFunction.create(2, 500, BackOffStrategy.NoJitter);
backOffFunction = BackOffFunction.create(10, 640, BackOffStrategy.EqualJitter);
break;
}
return backOffFunction;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/tikv/common/PDClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void testGetStore() throws Exception {
}

private BackOffer defaultBackOff() {
return ConcreteBackOffer.newCustomBackOff(1000);
return ConcreteBackOffer.newCustomBackOff(100);
}

@Test
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/org/tikv/common/RegionStoreClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,14 @@ public void doScanTest(RegionStoreClient client) throws Exception {
client.scan(defaultBackOff(), ByteString.copyFromUtf8("error1"), 1);
fail();
} catch (Exception e) {
e.printStackTrace();
assertTrue(true);
}
server.clearAllMap();
client.close();
}

private BackOffer defaultBackOff() {
return ConcreteBackOffer.newCustomBackOff(1000);
return ConcreteBackOffer.newCustomBackOff(50);
}
}