github-actions[bot] commented on code in PR #70826:
URL: https://github.com/apache/doris/pull/70826#discussion_r4649424624


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -2173,12 +2217,24 @@ public List<ResultRow> executeInternalQuery() {
                 LOG.warn("Failed to run internal SQL: {}", originStmt, e);
                 throw new RuntimeException("Failed to execute internal SQL. " 
+ Util.getRootCauseMessage(e), e);
             }
+            if (context.supportHandleByFe()) {
+                Optional<ResultSet> resultSet = 
planner.handleQueryInFe(parsedStmt);
+                if (resultSet.isPresent()) {
+                    isHandleQueryInFe = true;
+                    if (context.getSessionVariable().enableProfile() && 
profile != null) {
+                        
profile.getSummaryProfile().setExecutedByFrontend(true);
+                    }
+                    return resultSet.get().getResultRows().stream()
+                            .map(ResultRow::new)

Review Comment:
   [P3] Account for rows returned by the FE shortcut
   
   This return bypasses context.updateReturnRows(), which the existing BE batch 
path performs. The finally block still emits an internal audit event, and 
AuditLogHelper takes ReturnRows from that context counter. For example, the 
internal query for SHOW CHARSET WHERE TRUE now returns one ResultRow but 
records ReturnRows=0, as do other internal queries folded to nonempty FE 
results. Increment the counter by the FE result row count before returning so 
audit accounting remains consistent with the BE path.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1255,6 +1283,22 @@ public void cancel(Status cancelReason, boolean 
needWaitCancelComplete) {
         }
     }
 
+    public void setCoord(Coordinator coordinator) {
+        coord = coordinator;
+        Status cancelReason = pendingCoordinatorCancelReason.get();
+        if (coordinator != null && cancelReason != null) {
+            coordinator.cancel(cancelReason);

Review Comment:
   [P2] Stop cancelled work before starting its coordinator
   
   If KILL QUERY reaches an INSERT while it is planning (or an analysis task is 
cancelled during executeInternalQuery planning), this new replay marks the 
not-yet-started coordinator CANCELLED. Both Coordinator.shouldQueue() and 
NereidsCoordinator.shouldQueue() then skip workload-queue admission because 
isQueryCancelled() is true, but exec() still builds and dispatches the BE 
fragments without a status check. At replay time the remote execution 
contexts/tasks do not exist, so cancel() cannot cancel those future fragments. 
With workload/query queues enabled, cancelled scans can therefore start outside 
the configured concurrency limit; before this change they still went through 
the queue. Reject pending cancellation on the execution thread before starting 
work, or gate coordinator dispatch on its terminal status.



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