lokeshj1703 commented on a change in pull request #2808:
URL: https://github.com/apache/ozone/pull/2808#discussion_r752117371



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/balancer/FindTargetGreedy.java
##########
@@ -60,17 +61,27 @@ public FindTargetGreedy(
     this.containerManager = containerManager;
     this.placementPolicy = placementPolicy;
     this.nodeManager = nodeManager;
+
+    potentialTargets = new TreeSet<>((a, b) -> {
+      double currentUsageOfA = a.calculateUtilization(
+          sizeEnteringNode.get(a.getDatanodeDetails()));
+      double currentUsageOfB = b.calculateUtilization(
+          sizeEnteringNode.get(b.getDatanodeDetails()));
+      return Double.compare(currentUsageOfA, currentUsageOfB);

Review comment:
       Sorry for not bringing this up earlier! But we will need to handle the 
case in the comparator where utilisation is same for two nodes. Otherwise two 
nodes with same utilisation can not exist. It would be better to make similar 
change for source as well.




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