huangzhaobo99 commented on code in PR #7120:
URL: https://github.com/apache/hadoop/pull/7120#discussion_r1807376613


##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/BalancerParameters.java:
##########
@@ -110,6 +113,10 @@ boolean getSortTopNodes() {
     return this.sortTopNodes;
   }
 
+  int getlimitOverUtilizedNum() {

Review Comment:
   Fix



##########
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java:
##########
@@ -456,13 +460,20 @@ private long init(List<DatanodeStorageReport> reports) {
       sortOverUtilized(overUtilizedPercentage);
     }
 
+    // Limit the maximum number of overUtilized datanodes
+    // If excludedOverUtilizedNum is greater than 0, The overUtilized nodes 
num is limited
+    int excludedOverUtilizedNum = Math.max(overUtilized.size() - 
limitOverUtilizedNum, 0);
+    if (excludedOverUtilizedNum > 0) {
+      limitOverUtilizedNum();
+    }
+
     logUtilizationCollections();
     metrics.setNumOfOverUtilizedNodes(overUtilized.size());
     metrics.setNumOfUnderUtilizedNodes(underUtilized.size());
-    
-    Preconditions.checkState(dispatcher.getStorageGroupMap().size()
-        == overUtilized.size() + underUtilized.size() + aboveAvgUtilized.size()
-           + belowAvgUtilized.size(),
+

Review Comment:
   Fix



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

To unsubscribe, e-mail: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to