You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/09/14 15:23:57 UTC

[GitHub] [ozone] JacksonYao287 commented on a change in pull request #2631: HDDS-5733. Incorrect calculation of iteration related metrics in ContainerBalancer

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



##########
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:
       
   
   
   ```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++;
       }
   ```
   NIT




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org