ソースを参照

HDFS-2012. Balancer incorrectly treats nodes whose utilization equals avgUtilization. Contributed by Uma Maheswara Rao G.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22@1183450 13f79535-47bb-0310-9956-ffa450edef68
Konstantin Shvachko 13 年 前
コミット
aecdb74dfb

+ 3 - 0
hdfs/CHANGES.txt

@@ -642,6 +642,9 @@ Release 0.22.0 - Unreleased
 
     HDFS-1762. Allow TestHDFSCLI to be run against a cluster (cos)
 
+    HDFS-2012. Balancer incorrectly treats nodes whose utilization equals
+    avgUtilization. (Uma Maheswara Rao G via shv)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

+ 10 - 4
hdfs/src/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java

@@ -997,7 +997,10 @@ public class Balancer implements Tool {
           this.aboveAvgUtilizedDatanodes.add((Source)datanodeS);
         } else {
           assert(isOverUtilized(datanodeS)) :
-            datanodeS.getName()+ "is not an overUtilized node";
+            datanodeS.getName()+ " is not an overUtilized node:" +
+            		" utilization=" + datanodeS.utilization +
+            		" avgUtilization=" + avgUtilization +
+            		" threshold=" + threshold;
           this.overUtilizedDatanodes.add((Source)datanodeS);
           overLoadedBytes += (long)((datanodeS.utilization-avgUtilization
               -threshold)*datanodeS.datanode.getCapacity()/100.0);
@@ -1008,7 +1011,10 @@ public class Balancer implements Tool {
           this.belowAvgUtilizedDatanodes.add(datanodeS);
         } else {
           assert (isUnderUtilized(datanodeS)) :
-            datanodeS.getName()+ "is not an underUtilized node"; 
+            datanodeS.getName()+ "is not an underUtilized node:" +
+            " utilization=" + datanodeS.utilization +
+            " avgUtilization=" + avgUtilization +
+            " threshold=" + threshold;
           this.underUtilizedDatanodes.add(datanodeS);
           underLoadedBytes += (long)((avgUtilization-threshold-
               datanodeS.utilization)*datanodeS.datanode.getCapacity()/100.0);
@@ -1440,11 +1446,11 @@ public class Balancer implements Tool {
     return datanode.utilization > (avgUtilization+threshold);
   }
   
-  /* Return true if the given datanode is above average utilized
+  /* Return true if the given datanode is above or equal to average utilized
    * but not overUtilized */
   private boolean isAboveAvgUtilized(BalancerDatanode datanode) {
     return (datanode.utilization <= (avgUtilization+threshold))
-        && (datanode.utilization > avgUtilization);
+        && (datanode.utilization >= avgUtilization);
   }
   
   /* Return true if the given datanode is underUtilized */