This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch auto-pick-69677-branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git

commit fcc291d93867c618341e5d81c0c45c1a0a1b5910
Author: yiguolei <[email protected]>
AuthorDate: Fri Nov 6 12:37:44 2026 +0800

    [fix](show command) some show command should not be forward to master 
(#69677)
    
    ### What problem does this PR solve?
    
    Issue Number: close #xxx
    
    Related PR: #xxx
    
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../doris/nereids/trees/plans/commands/ShowProcCommand.java    | 10 ++++++++++
 .../trees/plans/commands/ShowWorkloadGroupsCommand.java        |  7 ++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcCommand.java
index 8672a9d90f4..a6e82fa5d8c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowProcCommand.java
@@ -38,11 +38,17 @@ import org.apache.doris.qe.StmtExecutor;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.regex.Pattern;
 
 /**
  * show proc command
  */
 public class ShowProcCommand extends ShowCommand {
+    // Match the repeated slashes and whitespace accepted by 
ProcService.open().
+    private static final Pattern LOCAL_QUERY_PATH = Pattern.compile(
+            "[ 
\\t\\r\\n]*/+(?:current_queries|current_query_stmts|current_backend_instances)/*(?:[
 \\t\\r\\n].*)?",
+            Pattern.DOTALL);
+
     private final String path;
 
     /**
@@ -122,6 +128,10 @@ public class ShowProcCommand extends ShowCommand {
 
     @Override
     public RedirectStatus toRedirectStatus() {
+        // These nodes read this FE's coordinators, not cluster-wide query 
state.
+        if (LOCAL_QUERY_PATH.matcher(path).matches()) {
+            return RedirectStatus.NO_FORWARD;
+        }
         if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
             return RedirectStatus.FORWARD_NO_SYNC;
         } else {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowWorkloadGroupsCommand.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowWorkloadGroupsCommand.java
index 684d559b723..1ab9a6df8cd 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowWorkloadGroupsCommand.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ShowWorkloadGroupsCommand.java
@@ -91,10 +91,7 @@ public class ShowWorkloadGroupsCommand extends ShowCommand {
 
     @Override
     public RedirectStatus toRedirectStatus() {
-        if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
-            return RedirectStatus.FORWARD_NO_SYNC;
-        } else {
-            return RedirectStatus.NO_FORWARD;
-        }
+        // Running and waiting query counts belong to the local FE's query 
queues.
+        return RedirectStatus.NO_FORWARD;
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to