ZhaoBQ commented on a change in pull request #2858:
URL: https://github.com/apache/hbase/pull/2858#discussion_r554933127



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
##########
@@ -276,18 +273,22 @@ private double getAverageRegionSizeMb(final 
List<RegionInfo> tableRegions) {
       LOG.warn("TableDescriptor for {} unavailable, table-level target region 
count and size"
         + " configurations cannot be considered.", table, e);
     }
-
-    double avgRegionSize;
     if (targetRegionSize > 0) {
       avgRegionSize = targetRegionSize;
-    } else if (targetRegionCount > 0) {
-      avgRegionSize = totalSizeMb / (double) targetRegionCount;
     } else {
-      avgRegionSize = totalSizeMb / (double) regionCount;
+      final int regionCount = tableRegions.size();
+      final long totalSizeMb = tableRegions.stream()
+        .mapToLong(this::getRegionSizeMB)
+        .sum();

Review comment:
       Yes, this is origin goal. If we set  NormalizerTargetRegionSize, we use 
NormalizerTargetRegionSize as avgRegionSize and return. But now I found another 
serious bug, NormalizerTargetRegionCount and NormalizerTargetRegionSize will 
never used when log level is not debug.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to