Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
bbeaudreault committed Feb 18, 2023
1 parent c06f052 commit b8528fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,17 +359,18 @@ private void cleanOverlappingRegions(RegionLocations locations, TableCache table

while (true) {
Map.Entry<byte[], RegionLocations> 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())
) {
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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
}

0 comments on commit b8528fe

Please sign in to comment.