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



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/ContainerBalancer.java
##########
@@ -589,14 +595,23 @@ private boolean moveContainer(DatanodeDetails source,
       Set<DatanodeDetails> selectedTargets,
       ContainerMoveSelection moveSelection, DatanodeDetails source) {
     countDatanodesInvolvedPerIteration += 2;
+    // don't count a source that has been involved in move earlier
+    if (sourceToTargetMap.containsKey(source) ||
+        selectedTargets.contains(source)) {
+      countDatanodesInvolvedPerIteration -= 1;
+    }
+    // don't count a target that has been involved in move earlier
+    if (selectedTargets.contains(moveSelection.getTargetNode())) {
+      countDatanodesInvolvedPerIteration -= 1;
+    }

Review comment:
       sorry, i made a mistake here
   ```suggestion
       // don't count a source that has been involved in move earlier
       if (!sourceToTargetMap.containsKey(source) &&
           !selectedTargets.contains(source)) {
         countDatanodesInvolvedPerIteration++;
       }
       // don't count a target that has been involved in move earlier
       if (!selectedTargets.contains(moveSelection.getTargetNode())) {
         countDatanodesInvolvedPerIteration++;
       }
   ```




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