You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/11/10 13:43:14 UTC
(doris) branch branch-2.0 updated: [fix](show_proc) fix show statistic proc dir to ensure that result only contains dbs in internal catalog (#26254) (#26763)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 7fd0195f842 [fix](show_proc) fix show statistic proc dir to ensure that result only contains dbs in internal catalog (#26254) (#26763)
7fd0195f842 is described below
commit 7fd0195f842c4de9394da7126d615d60ea51641c
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Fri Nov 10 21:43:06 2023 +0800
[fix](show_proc) fix show statistic proc dir to ensure that result only contains dbs in internal catalog (#26254) (#26763)
backport #26254
Co-authored-by: caiconghui <55...@users.noreply.github.com>
---
.../doris/common/proc/StatisticProcNode.java | 2 +-
.../org/apache/doris/datasource/CatalogMgr.java | 16 --------
.../suites/show_p0/test_show_statistic_proc.groovy | 45 ++++++++++++++++++++++
3 files changed, 46 insertions(+), 17 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/StatisticProcNode.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/StatisticProcNode.java
index d91363ab3b6..6226f7dbd60 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/StatisticProcNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/StatisticProcNode.java
@@ -52,7 +52,7 @@ public class StatisticProcNode implements ProcNodeInterface {
@Override
public ProcResult fetchResult() throws AnalysisException {
- List<DBStatistic> statistics = env.getCatalogMgr().getDbIds().parallelStream()
+ List<DBStatistic> statistics = env.getInternalCatalog().getDbIds().parallelStream()
// skip information_schema database
.flatMap(id -> Stream.of(id == 0 ? null : env.getCatalogMgr().getDbNullable(id)))
.filter(Objects::nonNull).map(DBStatistic::new)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
index 5dd8a464119..637d2777a0d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
@@ -228,22 +228,6 @@ public class CatalogMgr implements Writable, GsonPostProcessable {
return null;
}
- public List<Long> getDbIds() {
- List<Long> dbIds = Lists.newArrayList();
- for (CatalogIf catalog : nameToCatalog.values()) {
- dbIds.addAll(catalog.getDbIds());
- }
- return dbIds;
- }
-
- public List<String> getDbNames() {
- List<String> dbNames = Lists.newArrayList();
- for (CatalogIf catalog : nameToCatalog.values()) {
- dbNames.addAll(catalog.getDbNames());
- }
- return dbNames;
- }
-
private void writeLock() {
lock.writeLock().lock();
}
diff --git a/regression-test/suites/show_p0/test_show_statistic_proc.groovy b/regression-test/suites/show_p0/test_show_statistic_proc.groovy
new file mode 100644
index 00000000000..88b2657757b
--- /dev/null
+++ b/regression-test/suites/show_p0/test_show_statistic_proc.groovy
@@ -0,0 +1,45 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_show_statistic_proc", "show") {
+
+ sql """drop user if exists test_show_statistic_proc_user1"""
+
+ sql """create user test_show_statistic_proc_user1 identified by '12345'"""
+
+ sql """grant ADMIN_PRIV on *.*.* to test_show_statistic_proc_user1"""
+
+ sql """create database test_statistic_proc_db"""
+
+ def result1 = connect(user = 'test_show_statistic_proc_user1', password = '12345', url = context.config.jdbcUrl) {
+ sql """ show proc '/statistic' """
+ }
+ def result2 = connect(user = 'test_show_statistic_proc_user1', password = '12345', url = context.config.jdbcUrl) {
+ sql """ show databases """
+ }
+ assertEquals(result1.size(), result2.size())
+ assertEquals(result1[result1.size() - 1][1].toInteger(), result2.size() - 1)
+ def containsTargetDb = false
+ result1.each { row ->
+ if (row[1] == 'default_cluster:test_statistic_proc_db') {
+ containsTargetDb = true
+ return
+ }
+ }
+ assertTrue(containsTargetDb)
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org