From 77b6b4dee390c49fb49257f1500ec216fe620819 Mon Sep 17 00:00:00 2001 From: Norbert Kalmar Date: Sat, 18 Dec 2021 04:58:16 +0100 Subject: [PATCH] HBASE-26340 TableSplit returns false size under 1MB (#3872) Signed-off-by: Peter Somogyi --- .../org/apache/hadoop/hbase/regionserver/HRegionServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 4bf2d9c25f1..ef415893534 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -1431,6 +1431,7 @@ public class HRegionServer extends HBaseServerBase int maxCompactedStoreFileRefCount = 0; int storeUncompressedSizeMB = 0; int storefileSizeMB = 0; + long storefileSizeByte = 0L; int memstoreSizeMB = (int) (r.getMemStoreDataSize() / 1024 / 1024); long storefileIndexSizeKB = 0; int rootLevelIndexSizeKB = 0; @@ -1448,7 +1449,7 @@ public class HRegionServer extends HBaseServerBase maxCompactedStoreFileRefCount = Math.max(maxCompactedStoreFileRefCount, currentMaxCompactedStoreFileRefCount); storeUncompressedSizeMB += (int) (store.getStoreSizeUncompressed() / 1024 / 1024); - storefileSizeMB += (int) (store.getStorefilesSize() / 1024 / 1024); + storefileSizeByte += store.getStorefilesSize(); //TODO: storefileIndexSizeKB is same with rootLevelIndexSizeKB? storefileIndexSizeKB += store.getStorefilesRootLevelIndexSize() / 1024; CompactionProgress progress = store.getCompactionProgress(); @@ -1460,6 +1461,9 @@ public class HRegionServer extends HBaseServerBase totalStaticIndexSizeKB += (int) (store.getTotalStaticIndexSize() / 1024); totalStaticBloomSizeKB += (int) (store.getTotalStaticBloomSize() / 1024); } + //HBASE-26340 Fix false "0" size under 1MB + storefileSizeMB = storefileSizeByte > 0 && storefileSizeByte <= 1024 * 1024 + ? 1 : (int) storefileSizeByte / 1024 / 1024; HDFSBlocksDistribution hdfsBd = r.getHDFSBlocksDistribution(); float dataLocality = hdfsBd.getBlockLocalityIndex(serverName.getHostname());