You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "clintropolis (via GitHub)" <gi...@apache.org> on 2023/11/01 12:55:28 UTC
Re: [PR] Relocating Table Schema Building: Shifting from Brokers to Coordinator for Improved Efficiency (druid)
clintropolis commented on code in PR #14985:
URL: https://github.com/apache/druid/pull/14985#discussion_r1378764455
##########
server/src/main/java/org/apache/druid/client/SegmentLoadInfo.java:
##########
@@ -59,6 +61,15 @@ public ImmutableSegmentLoadInfo toImmutableSegmentLoadInfo()
return new ImmutableSegmentLoadInfo(segment, servers);
}
+ /**
+ * Randomly return one server from the sets of {@code servers}
+ */
+ public DruidServerMetadata pickOne()
+ {
+ synchronized (this) {
Review Comment:
yea, something similar to what @cryptoe suggests; `Iterators.get` is just taking the iterator returned by the collection and calling hasNext to navigate to a specific index, so we could just return the last element available if the index we picked is no longer present (though a while loop might be a bit cleaner)
--
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org