You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/01/11 09:41:38 UTC
[GitHub] [hbase] wchevreuil commented on a change in pull request #2858: HBASE-25482 Improve SimpleRegionNormalizer#getAverageRegionSizeMb
wchevreuil commented on a change in pull request #2858:
URL: https://github.com/apache/hbase/pull/2858#discussion_r554921476
##########
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:
Sorry, just to be sure on the goal here, this is just to avoid this loop always happen, even when totalSizeMb is not been used?
----------------------------------------------------------------
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:
users@infra.apache.org