kfaraz commented on a change in pull request #11768:
URL: https://github.com/apache/druid/pull/11768#discussion_r722935109



##########
File path: 
server/src/main/java/org/apache/druid/server/coordinator/duty/BalanceSegments.java
##########
@@ -144,16 +144,21 @@ private void balanceTier(
     }
 
     final int maxSegmentsToMove = 
Math.min(params.getCoordinatorDynamicConfig().getMaxSegmentsToMove(), 
numSegments);
-    int decommissioningMaxPercentOfMaxSegmentsToMove =
-        
params.getCoordinatorDynamicConfig().getDecommissioningMaxPercentOfMaxSegmentsToMove();
-    int maxSegmentsToMoveFromDecommissioningNodes =
-        (int) Math.ceil(maxSegmentsToMove * 
(decommissioningMaxPercentOfMaxSegmentsToMove / 100.0));
-    log.info(
-        "Processing %d segments for moving from decommissioning servers",
-        maxSegmentsToMoveFromDecommissioningNodes
-    );
-    Pair<Integer, Integer> decommissioningResult =
-        balanceServers(params, decommissioningServers, activeServers, 
maxSegmentsToMoveFromDecommissioningNodes);
+
+    // Only do the work of calling balanceServers to move from decomissioning 
servers if there are > 0 decomissioning servers
+    Pair<Integer, Integer> decommissioningResult = new Pair<>(0, 0);
+    if (!decommissioningServers.isEmpty()) {

Review comment:
       Would it make sense to add this check inside `balanceServers()` method 
itself?
   It already has a check as follows:
   ```
   if (maxSegmentsToMove <= 0) {
         return new Pair<>(0, 0);
       }
   ```
   
   We could add a new else clause `else if (toMoveFrom.isEmpty() || 
toMoveTo.isEmpty())` to the above `if`.




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