yiguolei commented on code in PR #35602:
URL: https://github.com/apache/doris/pull/35602#discussion_r1618615315


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -1564,24 +1568,55 @@ public void cancel(Status cancelReason) {
     }
 
     // Handle kill statement.
-    private void handleKill() throws DdlException {
+    private void handleKill() throws UserException {
         KillStmt killStmt = (KillStmt) parsedStmt;
         ConnectContext killCtx = null;
         int id = killStmt.getConnectionId();
         String queryId = killStmt.getQueryId();
         if (id == -1) {
+            // when killCtx == null, this means the query not in FE,
+            // then we just send kill signal to BE
             killCtx = 
context.getConnectScheduler().getContextWithQueryId(queryId);
-            if (killCtx == null) {
-                ErrorReport.reportDdlException(ErrorCode.ERR_NO_SUCH_QUERY, 
queryId);
-            }
         } else {
             killCtx = context.getConnectScheduler().getContext(id);
             if (killCtx == null) {
                 ErrorReport.reportDdlException(ErrorCode.ERR_NO_SUCH_THREAD, 
id);
             }
         }
 
-        if (context == killCtx) {
+        if (killCtx == null) {
+            TUniqueId tQueryId = null;
+            try {
+                tQueryId = DebugUtil.printId(queryId);
+            } catch (NumberFormatException e) {
+                throw new UserException("invalid query id format");
+            }
+            LOG.info("kill query {}", queryId);
+            Collection<Backend> nodesToPublish = 
Env.getCurrentSystemInfo().getIdToBackend().values();
+            for (Backend be : nodesToPublish) {
+                if (be.isAlive()) {
+                    try {
+                        Status cancelReason = new 
Status(TStatusCode.CANCELLED, "user kill query");
+                        
ListenableFuture<InternalService.PCancelPlanFragmentResult> cancelResult =

Review Comment:
   do not need callback any more since only print a log. because the callback 
is a lambda, it will hold the stmt executor may occupy many memory.



-- 
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...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to