AmatyaAvadhanula commented on code in PR #14584:
URL: https://github.com/apache/druid/pull/14584#discussion_r1295459400


##########
server/src/main/java/org/apache/druid/server/coordinator/balancer/TierSegmentBalancer.java:
##########
@@ -221,4 +197,39 @@ private void markUnmoved(String reason, DataSegment 
segment)
     runStats.add(Stats.Segments.MOVE_SKIPPED, key, 1);
   }
 
+  /**
+   * Number of segments to move away from the decommissioning historicals of 
this tier.
+   */
+  private int getNumDecommSegmentsToMove(int maxSegmentsToMove)
+  {
+    final CoordinatorDynamicConfig dynamicConfig = 
params.getCoordinatorDynamicConfig();
+    if (decommissioningServers.isEmpty()) {
+      return 0;
+    } else if (dynamicConfig.isSmartSegmentLoading()) {
+      final int decommSegmentsToMove = 
decommissioningServers.stream().mapToInt(
+          server -> server.getProjectedSegments().getTotalSegmentCount()
+      ).sum();
+      return Math.min(decommSegmentsToMove, maxSegmentsToMove);
+    } else {
+      int maxPercentageToMove = 
dynamicConfig.getDecommissioningMaxPercentOfMaxSegmentsToMove();
+      return (int) Math.ceil(maxSegmentsToMove * (maxPercentageToMove / 
100.0));
+    }
+  }
+
+  /**
+   * Number of segments to move between the active historicals of this tier.
+   */
+  private int getNumActiveSegmentsToMove(int maxActiveSegmentsToMove)
+  {
+    final CoordinatorDynamicConfig dynamicConfig = 
params.getCoordinatorDynamicConfig();
+    if (activeServers.isEmpty()) {

Review Comment:
   activeServers.size < 2?



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