Skip to content

Commit

Permalink
[fix #740] Add more logs in getregionstore (#751)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
shiyuhang0 committed May 31, 2023
1 parent 71676ee commit cb26d58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/tikv/common/region/RegionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,13 @@ public TiRegion getRegionByKey(ByteString key, BackOffer backOffer) {
Pair<Metapb.Region, Metapb.Peer> 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();
Expand Down Expand Up @@ -240,6 +245,10 @@ public Pair<TiRegion, TiStore> 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<TiStore> tiflashStores = new ArrayList<>();
for (Peer peer : region.getLearnerList()) {
Expand Down

0 comments on commit cb26d58

Please sign in to comment.