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



##########
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:
       The suggestion looks wrong semantically since we want to exclude 
re-counting a node that we have already counted earlier. For example in the 
suggested code, if both the if conditions are satisfied, the result will equal 
2. But the correct result should be 0.




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