capistrant commented on code in PR #20155:
URL: https://github.com/apache/druid/pull/20155#discussion_r3866760755


##########
server/src/main/java/org/apache/druid/server/coordinator/loading/StrategicSegmentAssigner.java:
##########
@@ -538,6 +548,30 @@ private int loadPartialReplicas(
     return numLoadsQueued;
   }
 
+  /**
+   * Orders {@code eligibleServers} into the sequence a load should try them 
in: round robin across the tier when
+   * round-robin assignment is enabled, else by the balancer strategy.
+   * <p>
+   * The round-robin branch ignores {@code eligibleServers} and derives its 
candidates from the tier, keeping those
+   * that pass {@link ServerHolder#canLoadSegment} at the moment each one is 
taken. Callers pass their complete
+   * eligible set: the two branches otherwise disagree on which servers a load 
may target, and an empty
+   * {@code eligibleServers} does not imply an empty iterator.
+   * <p>
+   * Consume the result lazily. {@link RoundRobinServerSelector} advances a 
per-tier cursor on every element taken, so
+   * draining the iterator for a segment that needs one replica advances the 
cursor a full lap and hands the next
+   * segment the same starting server.
+   */
+  private Iterator<ServerHolder> serversToLoadSegment(
+      DataSegment segment,
+      String tier,
+      List<ServerHolder> eligibleServers
+  )
+  {
+    return useRoundRobinAssignment
+           ? serverSelector.getServersInTierToLoadSegment(tier, segment)

Review Comment:
   I'm going to address this in a follow up via the queue-budget accounting 
change after cancelation. This case is only impacting when not using smart 
segment balancing which has been the default in druid for some time. I agree 
that it makes sense to fix, but I'd like it to be reviewed separately. Will 
cross llink PR once it is up.



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