xiangfu0 commented on code in PR #19530:
URL: https://github.com/apache/pinot/pull/19530#discussion_r4021557349


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/BalancedInstanceSelector.java:
##########
@@ -45,11 +47,13 @@ public class BalancedInstanceSelector extends 
BaseInstanceSelector {
   @Override
   public InstanceMapping select(List<String> segments, int requestId,
       SegmentStates segmentStates, Map<String, String> queryOptions) {
-    Map<String, String> segmentToSelectedInstanceMap = new 
HashMap<>(HashUtil.getHashMapCapacity(segments.size()));
+    // Allocate the flat map only when a required segment is selected. It 
avoids one map node per segment without
+    // reserving large arrays for queries whose segments are all optional or 
unavailable.
+    Map<String, String> segmentToSelectedInstanceMap = null;

Review Comment:
   Removed the lazy guard in both selectors in e0fff4d7cf; required maps are 
now allocated eagerly. The four broker quality checks and all 111 
routing-manager/selector tests passed. I am also updating the benchmark 
evidence to distinguish allocation savings from throughput and to include the 
eager-map optional/unavailable tradeoff.



##########
pinot-broker/pom.xml:
##########
@@ -49,6 +49,10 @@
       <groupId>org.apache.pinot</groupId>
       <artifactId>pinot-timeseries-planner</artifactId>
     </dependency>
+    <dependency>

Review Comment:
   Removed the direct fastutil dependency in e0fff4d7cf. The existing 
transitive dependency supplies the managed version; the normal broker reactor 
build and all 111 focused routing-manager/selector tests passed with this 
declaration removed.



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