You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/15 21:41:27 UTC

[GitHub] [pinot] vvivekiyer commented on a diff in pull request #9803: Optimize AdaptiveServerSelection for replicaGroup based routing

vvivekiyer commented on code in PR #9803:
URL: https://github.com/apache/pinot/pull/9803#discussion_r1023285220


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/adaptiveserverselector/LatencySelector.java:
##########
@@ -79,4 +81,30 @@ public List<Pair<String, Double>> fetchAllServerRankingsWithScores() {
 
     return pairList;
   }
+
+  @Override

Review Comment:
   The java doc is added in the interface file. Added more details to clarify the rationale.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/instanceselector/ReplicaGroupInstanceSelector.java:
##########
@@ -156,4 +159,20 @@ private void selectServersUsingAdaptiverServerSelector(List<String> segments, in
       segmentToSelectedInstanceMap.put(segment, selectedInstance);
     }
   }
+
+  private List<String> fetchCandidateServersForQuery(List<String> segments,
+      Map<String, List<String>> segmentToEnabledInstancesMap) {
+    List<String> serversList = new ArrayList<>();
+
+    Set<String> tempServerSet = new HashSet<>();
+    for (String segment : segments) {
+      List<String> enabledInstances = segmentToEnabledInstancesMap.get(segment);
+      if (enabledInstances != null) {
+        tempServerSet.addAll(enabledInstances);
+      }
+    }
+
+    serversList.addAll(tempServerSet);
+    return serversList;
+  }

Review Comment:
   It already exists. But they way the current code is written is, we do only one loop over segments. For each segment, we pick the server from the list of servers for the segment. 
   
   With AdaptiveServerSelection, we do an initial loop before to determine the list of servers for all segments that are touched by a query.  Then a ranking on them is performed. And then loop over the segments again and now determine which server to pick for a segment. 



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org