[fix](show_proc) fix show statistic proc dir to ensure that result only contains dbs in internal catalog (#26254)

This commit is contained in:
caiconghui
2023-11-03 20:12:06 +08:00
committed by GitHub
parent 7730a9025e
commit d367d9b585
3 changed files with 46 additions and 17 deletions

View File

@ -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)

View File

@ -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();
}