FrankChen021 commented on code in PR #20155:
URL: https://github.com/apache/druid/pull/20155#discussion_r3862682607
##########
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:
[P2] Canceled full-queue loads are not re-targeted
When a stale in-flight load is canceled on a server that started the run at
its configured load-queue limit, RoundRobinServerSelector still rejects that
server through ServerHolder.canLoadSegment: the queue slot is removed, but
maxAssignmentsInRun is not replenished. If no other fresh or additive candidate
exists, the method reports no eligible server and does not queue the
replacement until the next coordinator run. Preserve successfully canceled
servers as valid replacement candidates or update the queue-budget accounting
after cancellation, while continuing to reject decommissioning servers.
--
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]