Repository: hbase
Updated Branches:
  refs/heads/master ce493642c -> 4bb84f7d0


HBASE-16675 Average region size may be incorrect when there is region whose 
RegionLoad cannot be retrieved


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/4bb84f7d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/4bb84f7d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/4bb84f7d

Branch: refs/heads/master
Commit: 4bb84f7d0ce0159bda8412ff7b091cf011cad57a
Parents: ce49364
Author: tedyu <yuzhih...@gmail.com>
Authored: Thu Sep 22 07:33:34 2016 -0700
Committer: tedyu <yuzhih...@gmail.com>
Committed: Thu Sep 22 07:33:34 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/4bb84f7d/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
index fabd41a..a2a3f95 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/normalizer/SimpleRegionNormalizer.java
@@ -136,16 +136,18 @@ public class SimpleRegionNormalizer implements 
RegionNormalizer {
       ", number of regions: " + tableRegions.size());
 
     long totalSizeMb = 0;
+    int acutalRegionCnt = 0;
 
     for (int i = 0; i < tableRegions.size(); i++) {
       HRegionInfo hri = tableRegions.get(i);
       long regionSize = getRegionSize(hri);
       if (regionSize > 0) {
+        acutalRegionCnt++;
         totalSizeMb += regionSize;
       }
     }
 
-    double avgRegionSize = totalSizeMb / (double) tableRegions.size();
+    double avgRegionSize = acutalRegionCnt == 0 ? 0 : totalSizeMb / (double) 
acutalRegionCnt;
 
     LOG.debug("Table " + table + ", total aggregated regions size: " + 
totalSizeMb);
     LOG.debug("Table " + table + ", average region size: " + avgRegionSize);

Reply via email to