From fcc291d93867c618341e5d81c0c45c1a0a1b5910 Mon Sep 17 00:00:00 2001 From: yiguolei Date: Fri, 6 Nov 2026 12:37:44 +0800 Subject: [PATCH] [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 - [ ] 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 - Behavior changed: - [ ] No. - [ ] Yes. - Does this need documentation? - [ ] No. - [ ] Yes. ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label --- .../nereids/trees/plans/commands/ShowProcCommand.java | 10 ++++++++++ .../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 8672a9d90f4759..a6e82fa5d8ce89 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 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 R accept(PlanVisitor visitor, C context) { @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 684d559b7231b7..1ab9a6df8cda5e 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 String toString() { @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; } }