This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-4.2 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0212698619bc52847813aa7771e9c948d6867103 Author: deardeng <[email protected]> AuthorDate: Wed Oct 14 14:41:49 2026 +0800 [fix](fe) Report active compute group in processlist (#68111) (#68948) pick from https://github.com/apache/doris/pull/68111 Problem Summary: due to https://github.com/apache/doris/pull/50783 ,SHOW PROCESSLIST read the cached policy-selected compute group directly, while query routing gives precedence to the session compute group. When a session or per-query hint selected another compute group, the query ran there but PROCESSLIST reported the stale cached group. Prefer the active session compute group when rendering process rows and retain the cached value as the fallback. SHOW PROCESSLIST now reports the compute group used by the running query. - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.qe.ConnectContextTest - Behavior changed: Yes. The CloudCluster column now reports the active session compute group instead of a stale cached value. (cherry picked from commit 102f69734a26a97ebd88bd0bc90c627173046bb1) ### 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 --> --- .../main/java/org/apache/doris/qe/ConnectContext.java | 8 ++++++-- .../java/org/apache/doris/qe/ConnectContextTest.java | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java index d988d56f86d..d6a5b5932ea 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java @@ -1755,10 +1755,14 @@ public class ConnectContext { } row.add(Env.getCurrentEnv().getSelfNode().getHost()); - if (cloudCluster == null) { + String currentCloudCluster = sessionVariable.getCloudCluster(); + if (Strings.isNullOrEmpty(currentCloudCluster)) { + currentCloudCluster = cloudCluster; + } + if (currentCloudCluster == null) { row.add("NULL"); } else { - row.add(cloudCluster); + row.add(currentCloudCluster); } return row; } diff --git a/fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java b/fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java index b626f6acf8a..3bf5588e28e 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/qe/ConnectContextTest.java @@ -39,6 +39,7 @@ import org.apache.doris.mysql.privilege.Auth; import org.apache.doris.mysql.privilege.PrivPredicate; import org.apache.doris.qe.QueryState.MysqlStateType; import org.apache.doris.system.Backend; +import org.apache.doris.system.SystemInfoService; import org.apache.doris.thrift.TUniqueId; import org.apache.doris.transaction.TransactionStatus; @@ -339,6 +340,23 @@ public class ConnectContextTest { ctx.cleanup(); } + @Test + public void testThreadInfoUsesSessionCloudCluster() { + Env localEnv = Mockito.mock(Env.class); + try (MockedStatic<Env> mockedEnv = Mockito.mockStatic(Env.class)) { + mockedEnv.when(Env::getCurrentEnv).thenReturn(localEnv); + Mockito.when(localEnv.getSelfNode()) + .thenReturn(new SystemInfoService.HostInfo("127.0.0.1", 9030)); + + ConnectContext ctx = new ConnectContext(); + ctx.cloudCluster = "test"; + ctx.getSessionVariable().setCloudCluster("test1"); + + List<String> row = ctx.toThreadInfo(false).toRow(-1, 0, Optional.empty()); + Assert.assertEquals("test1", row.get(14)); + } + } + @Test public void testSleepTimeout() { ConnectContext ctx = new ConnectContext(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
