gortiz commented on code in PR #15609: URL: https://github.com/apache/pinot/pull/15609#discussion_r2055487926
########## pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java: ########## @@ -443,11 +443,27 @@ private BrokerResponse query(QueryEnvironment.CompiledQuery query, long requestI Tracing.ThreadAccountantOps.clear(); onQueryFinish(requestId); } - long executionEndTimeNs = System.nanoTime(); - updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, - executionEndTimeNs - executionStartTimeNs); BrokerResponseNativeV2 brokerResponse = new BrokerResponseNativeV2(); + + QueryProcessingException processingException = queryResults.getProcessingException(); + if (processingException != null) { + brokerResponse.addException(processingException); + QueryErrorCode errorCode = QueryErrorCode.fromErrorCode(processingException.getErrorCode()); + if (errorCode == QueryErrorCode.EXECUTION_TIMEOUT) { + for (String table : tableNames) { + _brokerMetrics.addMeteredTableValue(table, BrokerMeter.BROKER_RESPONSES_WITH_TIMEOUTS, 1); + } + LOGGER.warn("Timed out executing request {}: {}", requestId, query); + } + requestContext.setErrorCode(errorCode); + } else { + brokerResponse.setResultTable(queryResults.getResultTable()); + long executionEndTimeNs = System.nanoTime(); + updatePhaseTimingForTables(tableNames, BrokerQueryPhase.QUERY_EXECUTION, Review Comment: I'm not sure about that. In the older code, `submitAndReduce` in IICU could either throw an error or finish successfully. In the first case, we catch the exception and return a BrokerResponseNative without calling `updaterPhaseTimingForTables`. So we only call `updatePhaseTimingForTables` when queries finish successfully -- 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-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org