timothy-e commented on code in PR #18947:
URL: https://github.com/apache/pinot/pull/18947#discussion_r3761516459


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/StrictReplicaGroupInstanceSelector.java:
##########
@@ -50,14 +64,175 @@
  * segments with the same assignment ([S1, S2, S3]) down on S1 to ensure that 
we always route the segments to the same
  * replica-group.
  *
+ * When adaptive server selection is enabled, this selector uses 
replica-group-level adaptive routing: it picks the best
+ * replica group for the entire query (using worst-case server rank within 
each group) and routes all segments to
+ * that group. This preserves the same-replica-group guarantee while 
benefiting from adaptive routing intelligence.
+ *
  * Note that new segments won't be used to exclude instances from serving when 
the segment is unavailable.
  * </pre>
  */
 public class StrictReplicaGroupInstanceSelector extends 
ReplicaGroupInstanceSelector {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(StrictReplicaGroupInstanceSelector.class);
 
   @Override
   void updateSegmentMaps(IdealState idealState, ExternalView externalView, 
Set<String> onlineSegments,
       Map<String, Long> newSegmentCreationTimeMap) {
     super.updateSegmentMapsForUpsertTable(idealState, externalView, 
onlineSegments, newSegmentCreationTimeMap);
   }
+
+  @Override
+  public InstanceMapping select(List<String> segments, int requestId,
+      SegmentStates segmentStates, Map<String, String> queryOptions) {
+
+    if (_adaptiveServerSelector == null || _priorityPoolInstanceSelector == 
null) {
+      ServerSelectionContext ctx = new ServerSelectionContext(queryOptions, 
_config);
+      return selectServers(segments, requestId, segmentStates, null, ctx);
+    }
+
+    // Build a map: idealStateReplicaId (replica group) -> distinct servers in 
that group that are candidates for this

Review Comment:
   Great catch, I think you were reading it correctly. I reworked it in the 
latest commit and it allows me to throw away all of the code I had added. I'll 
need to manually retest the PR.  



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