Skip to content

Commit

Permalink
HBASE-29035: Amount of region cached in the region metrics not update…
Browse files Browse the repository at this point in the history
…d for a region immediately after it is flushed with cacheOnWrite turned on
  • Loading branch information
ragarkar committed Dec 18, 2024
1 parent 39d4785 commit badf072
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ private void doTestEvictOnClose(String table, boolean evictOnClose,
}
}

private void createTable(TableName tableName, boolean shouldFlushTable) throws IOException, InterruptedException {
private void createTable(TableName tableName, boolean shouldFlushTable)
throws IOException, InterruptedException {
byte[] family = Bytes.toBytes("CF");
TableDescriptor td = TableDescriptorBuilder.newBuilder(tableName)
.setColumnFamily(ColumnFamilyDescriptorBuilder.of(family)).build();
Expand Down Expand Up @@ -199,17 +200,17 @@ public void testCacheWithFlush() throws Exception {

private void checkRegionCached(TableName tableName, boolean isCached) throws IOException {
UTIL.getMiniHBaseCluster().getRegions(tableName).forEach(r -> {
try {
UTIL.getMiniHBaseCluster().getClusterMetrics().getLiveServerMetrics().forEach((sn, sm) -> {
for (Map.Entry<byte[], RegionMetrics> rm : sm.getRegionMetrics().entrySet()) {
if (rm.getValue().getNameAsString().equals(r.getRegionInfo().getRegionNameAsString())) {
assertTrue(isCached == (rm.getValue().getCurrentRegionCachedRatio() > 0.0f));
}
try {
UTIL.getMiniHBaseCluster().getClusterMetrics().getLiveServerMetrics().forEach((sn, sm) -> {
for (Map.Entry<byte[], RegionMetrics> rm : sm.getRegionMetrics().entrySet()) {
if (rm.getValue().getNameAsString().equals(r.getRegionInfo().getRegionNameAsString())) {
assertTrue(isCached == (rm.getValue().getCurrentRegionCachedRatio() > 0.0f));
}
});
} catch (IOException e) {
throw new RuntimeException(e);
}
}
});
} catch (IOException e) {
throw new RuntimeException(e);
}
});
}
}

0 comments on commit badf072

Please sign in to comment.