Jackie-Jiang commented on code in PR #17619:
URL: https://github.com/apache/pinot/pull/17619#discussion_r2761384222
##########
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);
Review Comment:
Replace other usage of `convertToSortedMap(idealStateInstanceStateMap)` to
this.
We should consider adding to TODO to check if sorting is indeed needed
##########
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:
Since we always loop over IS, we should be able to reduce map lookup by
tracking the iteration while looping over IS
--
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]