From b8528fee4eced8cb32a4151c7f2b1bfa573b529d Mon Sep 17 00:00:00 2001 From: Bryan Beaudreault Date: Fri, 17 Feb 2023 19:42:12 -0500 Subject: [PATCH] Fix test --- .../hadoop/hbase/client/AsyncNonMetaRegionLocator.java | 9 +++++---- .../hbase/client/TestAsyncTableLocatePrefetch.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java index e1375c36babe..7e252f50c691 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncNonMetaRegionLocator.java @@ -359,7 +359,7 @@ private void cleanOverlappingRegions(RegionLocations locations, TableCache table while (true) { Map.Entry overlap = - isLast ? tableCache.cache.lastEntry() : tableCache.cache.floorEntry(region.getEndKey()); + isLast ? tableCache.cache.lastEntry() : tableCache.cache.lowerEntry(region.getEndKey()); if ( overlap == null || overlap.getValue() == locations || Bytes.equals(overlap.getKey(), region.getStartKey()) @@ -367,9 +367,10 @@ private void cleanOverlappingRegions(RegionLocations locations, TableCache table break; } - if (LOG.isTraceEnabled()) { - LOG.trace("Removing cached location {} because it overlaps with new location {}", - overlap.getValue(), locations); + if (LOG.isInfoEnabled()) { + LOG.info("Removing cached location {} (endKey={}) because it overlaps with new location {} (endKey={})", + overlap.getValue(), Bytes.toStringBinary(overlap.getValue().getRegionLocation().getRegion().getEndKey()), + locations, Bytes.toStringBinary(locations.getRegionLocation().getRegion().getEndKey())); } tableCache.cache.remove(overlap.getKey()); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocatePrefetch.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocatePrefetch.java index bca1b2a2588b..a43d98e7120a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocatePrefetch.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocatePrefetch.java @@ -76,7 +76,7 @@ public void test() throws InterruptedException, ExecutionException { // confirm that the locations of all the regions have been cached. assertNotNull(LOCATOR.getRegionLocationInCache(TABLE_NAME, Bytes.toBytes("aaa"))); for (byte[] row : HBaseTestingUtil.KEYS_FOR_HBA_CREATE_TABLE) { - assertNotNull(LOCATOR.getRegionLocationInCache(TABLE_NAME, row)); + assertNotNull("Expected location to not be null for " + Bytes.toStringBinary(row), LOCATOR.getRegionLocationInCache(TABLE_NAME, row)); } } }