Repository: hbase
Updated Branches:
  refs/heads/branch-1 76da21fc5 -> ba650a8a1


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/ba650a8a
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ba650a8a
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ba650a8a

Branch: refs/heads/branch-1
Commit: ba650a8a1057dd5d77cd400cc22e717b478a5721
Parents: 76da21f
Author: tedyu <yuzhih...@gmail.com>
Authored: Thu Sep 22 07:34:29 2016 -0700
Committer: tedyu <yuzhih...@gmail.com>
Committed: Thu Sep 22 07:34:29 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/ba650a8a/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 acf12b4..c18a49a 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
@@ -124,16 +124,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