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


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BaseInstanceSelector.java:
##########
@@ -261,16 +261,27 @@ void updateSegmentMaps(IdealState idealState, 
ExternalView externalView, Set<Str
     Set<Integer> pools = new HashSet<>();
     for (String segment : onlineSegments) {
       Map<String, String> idealStateInstanceStateMap = 
idealStateAssignment.get(segment);
+      Map<String, String> sortedIdealStateMap = 
convertToSortedMap(idealStateInstanceStateMap);
       Long newSegmentCreationTimeMs = newSegmentCreationTimeMap.get(segment);
       Map<String, String> externalViewInstanceStateMap = 
externalViewAssignment.get(segment);
+
+      // Build mapping from instance to position in ideal state (ideal state 
replica ID)
+      Map<String, Integer> instanceToIdealStateReplicaId = new HashMap<>();
+      int idealStateReplicaId = 0;
+      for (String instance : sortedIdealStateMap.keySet()) {

Review Comment:
   It will introduce a per segment short-lived map and one extra map lookup per 
segment-instance pair. Let me try if it is easy to avoid



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