github-code-scanning[bot] commented on code in PR #14584:
URL: https://github.com/apache/druid/pull/14584#discussion_r1263596630


##########
server/src/main/java/org/apache/druid/server/coordinator/balancer/TierSegmentBalancer.java:
##########
@@ -221,4 +206,62 @@
     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();

Review Comment:
   ## Deprecated method or constructor invocation
   
   Invoking 
[CoordinatorDynamicConfig.getDecommissioningMaxPercentOfMaxSegmentsToMove](1) 
should be avoided because it has been deprecated.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/5279)



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