Skip to content
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/ConfigUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public class ConfigUtils {
public static final int DEF_TIKV_RAWKV_SCAN_TIMEOUT_IN_MS = 10000;
public static final int DEF_TIKV_RAWKV_CLEAN_TIMEOUT_IN_MS = 600000;

public static final int DEF_TIKV_BO_REGION_MISS_BASE_IN_MS = 100;
public static final int DEF_TIKV_BO_REGION_MISS_BASE_IN_MS = 20;

public static final String NORMAL_COMMAND_PRIORITY = "NORMAL";
public static final String LOW_COMMAND_PRIORITY = "LOW";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ public boolean onNotLeader(TiRegion newRegion) {
@Override
public boolean onStoreUnreachable() {
if (!targetStore.isValid()) {
logger.warn(
String.format("store [%d] has been invalid", region.getId(), targetStore.getId()));
logger.warn(String.format("store [%d] has been invalid", targetStore.getId()));
targetStore = regionManager.getStoreById(targetStore.getId());
updateClientStub();
return true;
Expand Down Expand Up @@ -159,7 +158,7 @@ public boolean onStoreUnreachable() {
}
logger.warn(
String.format(
"retry time exceed for region[%d], invalid this region[%d]",
"retry time exceed for region[%d], invalid store[%d]",
region.getId(), targetStore.getId()));
regionManager.onRequestFail(region);
return false;
Expand Down Expand Up @@ -194,11 +193,6 @@ public void tryUpdateRegionStore() {
// create a new store object, which is can-forward.
regionManager.updateStore(originStore, targetStore);
} else {
// If we try to forward request to leader by follower failed, it means that the store of old
// leader may be
// unavailable but the new leader has not been report to PD. So we can ban this store for a
// short time to
// avoid too many request try forward rather than try other peer.
originStore.forwardFail();
}
}
Expand Down Expand Up @@ -260,7 +254,18 @@ private void updateClientStub() {
}

private boolean retryOtherStoreByProxyForward() {
if (!conf.getEnableGrpcForward() || retryForwardTimes > region.getFollowerList().size()) {
if (!conf.getEnableGrpcForward()) {
return false;
}
if (retryForwardTimes >= region.getFollowerList().size()) {
// If we try to forward request to leader by follower failed, it means that the store of old
// leader may be
// unavailable but the new leader has not been report to PD. So we can ban this store for a
// short time to
// avoid too many request try forward rather than try other peer.
if (originStore != null) {
originStore.forwardFail();
}
return false;
}
TiStore proxyStore = switchProxyStore();
Expand All @@ -269,6 +274,11 @@ private boolean retryOtherStoreByProxyForward() {
String.format(
"no forward store can be selected for store [%s] and region[%d]",
targetStore.getStore().getAddress(), region.getId()));
if (originStore != null) {
originStore.forwardFail();
} else {
targetStore.forwardFail();
}
return false;
}
if (originStore == null) {
Expand Down