saurabhd336 commented on code in PR #12276:
URL: https://github.com/apache/pinot/pull/12276#discussion_r1460177601


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/MultiStageReplicaGroupSelector.java:
##########
@@ -86,7 +87,16 @@ Pair<Map<String, String>, Map<String, String>> 
select(List<String> segments, int
       SegmentStates segmentStates, Map<String, String> queryOptions) {
     // Create a copy of InstancePartitions to avoid race-condition with 
event-listeners above.
     InstancePartitions instancePartitions = _instancePartitions;
-    int replicaGroupSelected = requestId % 
instancePartitions.getNumReplicaGroups();
+    int replicaGroupSelected;
+    if (_useStickyRouting) {
+      // When using sticky routing, we want to iterate over the 
instancePartitions in order to ensure deterministic
+      // selection of replica group across queries i.e. same instance replica 
group id is picked each time.
+      // Since the instances within a selected replica group are iterated in 
order, the assignment within a selected
+      // replica group is guaranteed to be deterministic.
+      replicaGroupSelected = 0;

Review Comment:
   Added a note comment



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