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


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/service/dispatch/QueryDispatcher.java:
##########
@@ -212,36 +242,64 @@ public QueryResult submitAndReduce(RequestContext 
context, DispatchableSubPlan d
     }
     long requestId = context.getRequestId();
     Set<QueryServerInstance> servers = new HashSet<>();
-    // Tracks servers where recordStatsForQuerySubmission was actually called, 
so the finally block only
-    // decrements servers that were incremented — guarding against a partial 
failure in submit().
     Set<QueryServerInstance> incrementedServers = new HashSet<>();
-    try {
-      submit(requestId, dispatchableSubPlan, timeoutMs, servers, queryOptions);
-      // The SSE engine increments before `submit`, but here we increment 
after because `submit` populates
-      // the list of servers. Getting the list of servers before calling 
`submit` would expose
-      // implementation details of `submit`.
-      if (statsManager != null) {
-        for (QueryServerInstance server : servers) {
-          statsManager.recordStatsForQuerySubmission(requestId, 
server.getInstanceId());
-          incrementedServers.add(server);
+    long submitTimeMs = _clock.getAsLong();
+    QueryResult result = null;
+    CancelOutcome cancelOutcome = CancelOutcome.NONE;
+
+    AdaptiveRoutingStageClassification classification = null;
+    Consumer<QueryServerInstance> preDispatchHook = null;
+    if (statsManager != null) {
+      classification = 
AdaptiveRoutingStageClassification.classify(dispatchableSubPlan);

Review Comment:
   This adds the trusted-stage/timing setup for the unary path, but 
`submitAndReduceWithStream()` still never does the equivalent classification / 
`COLLECT_UPSTREAM_TIMING_KEY` wiring and still decrements every server with 
`-1`. So a query that enables `STREAM_STATS` silently loses the new MSE latency 
signal entirely, including submit-timeout cases. Can we plumb the same flow 
into stream mode, or explicitly gate adaptive-routing latency off there?



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