From cb26d58a41c30549593bdf0c2fcedbc6d2642961 Mon Sep 17 00:00:00 2001 From: shi yuhang <52435083+shiyuhang0@users.noreply.github.com> Date: Wed, 31 May 2023 16:50:33 +0800 Subject: [PATCH] [fix #740] Add more logs in getregionstore (#751) * 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> --- src/main/java/org/tikv/common/region/RegionManager.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/org/tikv/common/region/RegionManager.java b/src/main/java/org/tikv/common/region/RegionManager.java index 3a76aa8beb..9678d9e813 100644 --- a/src/main/java/org/tikv/common/region/RegionManager.java +++ b/src/main/java/org/tikv/common/region/RegionManager.java @@ -177,8 +177,13 @@ public TiRegion getRegionByKey(ByteString key, BackOffer backOffer) { Pair regionAndLeader = pdClient.getRegionByKey(backOffer, key); region = 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) { + logger.warn("Get region failed: ", e); return null; } finally { requestTimer.observeDuration(); @@ -240,6 +245,10 @@ public Pair getRegionStorePairByKey( } 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 { List tiflashStores = new ArrayList<>(); for (Peer peer : region.getLearnerList()) {