Jackie-Jiang commented on code in PR #12276:
URL: https://github.com/apache/pinot/pull/12276#discussion_r1459888168


##########
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:
   Good point. IIRC we are not using this selector, so both 2 and 3 (1 breaks 
the contract which is not okay) are fine. If we go with 2, let's add a note 
describing the potential hotspot problem, or we go with 3 and add a todo



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