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


##########
pinot-core/src/main/java/org/apache/pinot/core/query/scheduler/QueryScheduler.java:
##########
@@ -197,40 +205,60 @@ protected DataBuffer 
processQueryAndSerializeResponse(ServerQueryRequest queryRe
       responseMetadata.put(MetadataKey.REQUEST_ID.getName(), 
Long.toString(requestId));
       responseMetadata.put(MetadataKey.QUERY_ID.getName(), queryId);
       responseMetadata.put(MetadataKey.WORKLOAD_NAME.getName(), workloadName);
-      DataBuffer response = serializeResponse(queryRequest, instanceResponse);
+      DataBuffer response;
+      ResponseSizeLimitExceededException responseSizeLimitException = null;
+      try {
+        response = serializeResponse(queryRequest, instanceResponse);
+      } catch (ResponseSizeLimitExceededException e) {
+        response = null;
+        responseSizeLimitException = e;
+      }
 
-      // Log the statistics
+      // Log the statistics before an error response replaces the 
serialization timer of the query
       if (_queryLogger != null) {
         _queryLogger.logQuery(queryRequest, instanceResponse, name());

Review Comment:
   On the early-overflow path, this now runs before `TOTAL_QUERY_TIME` is 
recorded. The `ResponseSizeLimitExceededException` catch in `serializeResponse` 
rethrows before `startNewPhaseTimer(TOTAL_QUERY_TIME, ...)` runs. So the log 
line shows `totalTimeMs=-1`, and `WORKLOAD_TOTAL_QUERY_TIME_MS` gets -1. 
Yammer's `Timer.update` drops negative values, so these queries silently 
disappear from that timer. I reproduced it with a scratch test: early overflow 
records -1, while the post-serialization and no-limit paths record 1 ms and 8 
ms. One fix is to record the total-time phase in that catch before rethrowing.



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