JacksonYao287 commented on a change in pull request #2676:
URL: https://github.com/apache/ozone/pull/2676#discussion_r718201671



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -652,8 +670,24 @@ private double ratioToBytes(Long nodeCapacity, double 
utilizationRatio) {
    */
   boolean canSizeEnterTarget(DatanodeDetails target, long size) {
     if (sizeEnteringNode.containsKey(target)) {
-      return sizeEnteringNode.get(target) + size <=
-          config.getMaxSizeEnteringTarget();
+      long sizeEnteringAfterMove = sizeEnteringNode.get(target) + size;
+      SCMNodeMetric scmNM = nodeManager.getNodeStat(target);
+      Preconditions.checkNotNull(scmNM);
+      SCMNodeStat scmNodeStat = scmNM.get();
+      double capacity = scmNodeStat.getCapacity().get();
+      Preconditions.checkArgument(capacity > 0);
+
+      //size can be moved into target datanode only when the following
+      //two condition are met.
+      //1 sizeEnteringAfterMove does not succeed the configured
+      // MaxSizeEnteringTarget
+      //2 current usage of target datanode plus sizeEnteringAfterMove
+      // is smaller than or equal to upperLimit
+      double usedAfterMove =
+          capacity - scmNodeStat.getRemaining().get() + sizeEnteringAfterMove;
+

Review comment:
       yea , i have updated this patch , PTAL!




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