qqvpp commented on code in PR #7035: URL: https://github.com/apache/hbase/pull/7035#discussion_r2123551703
########## hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java: ########## @@ -322,14 +322,27 @@ private double getAverageRegionSizeMb(final List<RegionInfo> tableRegions, avgRegionSize = targetRegionSize; } else { final int regionCount = tableRegions.size(); - final long totalSizeMb = tableRegions.stream().mapToLong(this::getRegionSizeMB).sum(); + // Count of regions whose size is known + int regionCountKnownSize = 0; + long totalSizeMb = 0; + for (RegionInfo regionInfo : tableRegions) { + long regionSize = getRegionSizeMB(regionInfo); + if (regionSize != -1) { + totalSizeMb += regionSize; + regionCountKnownSize++; + } + } if (targetRegionCount > 0) { - avgRegionSize = totalSizeMb / (double) targetRegionCount; + avgRegionSize = + totalSizeMb / (double) targetRegionCount - (regionCount - regionCountKnownSize); } else { - avgRegionSize = totalSizeMb / (double) regionCount; + avgRegionSize = totalSizeMb / (double) regionCountKnownSize; Review Comment: I added the condition, including the test modification. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org