kfaraz commented on code in PR #13197:
URL: https://github.com/apache/druid/pull/13197#discussion_r991336008


##########
server/src/main/java/org/apache/druid/server/coordinator/BalancerSegmentHolder.java:
##########
@@ -19,29 +19,28 @@
 
 package org.apache.druid.server.coordinator;
 
-import org.apache.druid.client.ImmutableDruidServer;
 import org.apache.druid.timeline.DataSegment;
 
 /**
  */
 public class BalancerSegmentHolder

Review Comment:
   Change summary:
   Added `ServerHolder` to avoid having to find the corresponding peon later in 
the flow.



##########
server/src/main/java/org/apache/druid/server/coordinator/BalancerStrategy.java:
##########
@@ -46,13 +46,18 @@
   ServerHolder findNewSegmentHomeBalancer(DataSegment proposalSegment, 
List<ServerHolder> serverHolders);
 
   /**
-   * Find the best server on which to place a {@link DataSegment} replica 
according to the balancing strategy
+   * Finds the best servers on which to place a replica of the {@code 
proposalSegment}
+   * according to the balancing strategy.
+   *
    * @param proposalSegment segment to replicate
-   * @param serverHolders servers to consider as replica holders
-   * @return The server to replicate to, or null if no suitable server is found
+   * @param serverHolders   servers to consider as replica holders
+   * @return Iterator over the best servers (in order) on which the replica(s)
+   * can be placed.
    */
-  @Nullable
-  ServerHolder findNewSegmentHomeReplicator(DataSegment proposalSegment, 
List<ServerHolder> serverHolders);
+  Iterator<ServerHolder> findNewSegmentHomeReplicator(

Review Comment:
   Change summary:
   Find all the best servers to place replicas in one go rather than multiple 
strategy computations.



##########
server/src/main/java/org/apache/druid/server/coordinator/CostBalancerStrategy.java:
##########
@@ -184,20 +193,17 @@ public CostBalancerStrategy(ListeningExecutorService exec)
   }
 
   @Override
-  public ServerHolder findNewSegmentHomeReplicator(DataSegment 
proposalSegment, List<ServerHolder> serverHolders)
+  public Iterator<ServerHolder> findNewSegmentHomeReplicator(DataSegment 
proposalSegment, List<ServerHolder> serverHolders)

Review Comment:
   Change summary:
   Find all the best servers to place replicas in one go.



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