mirror of https://github.com/tikv/client-java.git
* optimize getregionstore logical Signed-off-by: shiyuhang <1136742008@qq.com> * decrease impact Signed-off-by: shiyuhang <1136742008@qq.com> * Update RegionManager.java Signed-off-by: shiyuhang <1136742008@qq.com> * [close #749] Fix health checking issue (#748) Signed-off-by: shiyuhang <1136742008@qq.com> * Update RegionManager.java Signed-off-by: shiyuhang <1136742008@qq.com> * add log Signed-off-by: shiyuhang <1136742008@qq.com> * change log level Signed-off-by: shiyuhang <1136742008@qq.com> --------- Signed-off-by: shiyuhang <1136742008@qq.com>
This commit is contained in:
parent
71676ee369
commit
cb26d58a41
|
@ -177,8 +177,13 @@ public class RegionManager {
|
||||||
Pair<Metapb.Region, Metapb.Peer> regionAndLeader = pdClient.getRegionByKey(backOffer, key);
|
Pair<Metapb.Region, Metapb.Peer> regionAndLeader = pdClient.getRegionByKey(backOffer, key);
|
||||||
region =
|
region =
|
||||||
cache.putRegion(createRegion(regionAndLeader.first, regionAndLeader.second, backOffer));
|
cache.putRegion(createRegion(regionAndLeader.first, regionAndLeader.second, backOffer));
|
||||||
|
logger.debug(
|
||||||
|
String.format(
|
||||||
|
"get region id: %d with leader: %d",
|
||||||
|
region.getId(), region.getLeader().getStoreId()));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.warn("Get region failed: ", e);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
requestTimer.observeDuration();
|
requestTimer.observeDuration();
|
||||||
|
@ -240,6 +245,10 @@ public class RegionManager {
|
||||||
}
|
}
|
||||||
logger.info("Store {} is unreachable, try to get the next replica", peer.getStoreId());
|
logger.info("Store {} is unreachable, try to get the next replica", peer.getStoreId());
|
||||||
}
|
}
|
||||||
|
// Does not set unreachable store to null in case it is incompatible with GrpcForward
|
||||||
|
if (store == null || !store.isReachable()) {
|
||||||
|
logger.warn("No TiKV store available for region: " + region);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
List<TiStore> tiflashStores = new ArrayList<>();
|
List<TiStore> tiflashStores = new ArrayList<>();
|
||||||
for (Peer peer : region.getLearnerList()) {
|
for (Peer peer : region.getLearnerList()) {
|
||||||
|
|
Loading…
Reference in New Issue