From 7f72c45c6f33c963d01694746ae3e9cd28b733ef Mon Sep 17 00:00:00 2001 From: morningman Date: Tue, 24 Oct 2023 18:07:24 +0800 Subject: [PATCH 1/2] 1 --- .../doris/service/FrontendServiceImpl.java | 41 ++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java index d9d0a03f3d0536..febd638e73dee0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java +++ b/fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java @@ -378,12 +378,23 @@ public TGetDbsResult getDbNames(TGetDbsParams params) throws TException { Env env = Env.getCurrentEnv(); List catalogIfs = Lists.newArrayList(); - if (Strings.isNullOrEmpty(params.catalog)) { - catalogIfs = env.getCatalogMgr().listCatalogs(); + // If infodb_support_ext_catalog is true, we will list all catalogs or the specified catalog. + // Otherwise, we will only list internal catalog, or if the specified catalog is internal catalog. + if (Config.infodb_support_ext_catalog) { + if (Strings.isNullOrEmpty(params.catalog)) { + catalogIfs = env.getCatalogMgr().listCatalogs(); + } else { + catalogIfs.add(env.getCatalogMgr() + .getCatalogOrException(params.catalog, + catalog -> new TException("Unknown catalog " + catalog))); + } } else { - catalogIfs.add(env.getCatalogMgr() - .getCatalogOrException(params.catalog, catalog -> new TException("Unknown catalog " + catalog))); + if (Strings.isNullOrEmpty(params.catalog) + || params.catalog.equalsIgnoreCase(InternalCatalog.INTERNAL_CATALOG_NAME)) { + catalogIfs.add(env.getInternalCatalog()); + } } + for (CatalogIf catalog : catalogIfs) { Collection dbs = new HashSet(); try { @@ -621,6 +632,11 @@ public TGetTablesResult getTableNames(TGetTablesParams params) throws TException } String catalogName = Strings.isNullOrEmpty(params.catalog) ? InternalCatalog.INTERNAL_CATALOG_NAME : params.catalog; + if (!Config.infodb_support_ext_catalog + && !catalogName.equalsIgnoreCase(InternalCatalog.INTERNAL_CATALOG_NAME)) { + throw new TException("Not support getting external catalog info when " + + "infodb_support_ext_catalog is false"); + } DatabaseIf db = Env.getCurrentEnv().getCatalogMgr() .getCatalogOrException(catalogName, catalog -> new TException("Unknown catalog " + catalog)) @@ -676,6 +692,12 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE if (params.isSetCatalog()) { catalogName = params.catalog; } + if (!Config.infodb_support_ext_catalog + && !catalogName.equalsIgnoreCase(InternalCatalog.INTERNAL_CATALOG_NAME)) { + throw new TException("Not support getting external catalog info when " + + "infodb_support_ext_catalog is false"); + } + CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(catalogName); if (catalog != null) { DatabaseIf db = catalog.getDbNullable(params.db); @@ -731,7 +753,6 @@ public TListTableStatusResult listTableStatus(TGetTablesParams params) throws TE } public TListTableMetadataNameIdsResult listTableMetadataNameIds(TGetTablesParams params) throws TException { - LOG.debug("get list simple table request: {}", params); TListTableMetadataNameIdsResult result = new TListTableMetadataNameIdsResult(); @@ -890,6 +911,11 @@ public TDescribeTableResult describeTable(TDescribeTableParams params) throws TE String catalogName = Strings.isNullOrEmpty(params.catalog) ? InternalCatalog.INTERNAL_CATALOG_NAME : params.catalog; + if (!Config.infodb_support_ext_catalog + && !catalogName.equalsIgnoreCase(InternalCatalog.INTERNAL_CATALOG_NAME)) { + throw new TException("Not support getting external catalog info when " + + "infodb_support_ext_catalog is false"); + } DatabaseIf db = Env.getCurrentEnv().getCatalogMgr() .getCatalogOrException(catalogName, catalog -> new TException("Unknown catalog " + catalog)) .getDbNullable(params.db); @@ -960,6 +986,11 @@ public TDescribeTablesResult describeTables(TDescribeTablesParams params) throws String catalogName = Strings.isNullOrEmpty(params.catalog) ? InternalCatalog.INTERNAL_CATALOG_NAME : params.catalog; + if (!Config.infodb_support_ext_catalog + && !catalogName.equalsIgnoreCase(InternalCatalog.INTERNAL_CATALOG_NAME)) { + throw new TException("Not support getting external catalog info when " + + "infodb_support_ext_catalog is false"); + } DatabaseIf db = Env.getCurrentEnv().getCatalogMgr() .getCatalogOrException(catalogName, catalog -> new TException("Unknown catalog " + catalog)) .getDbNullable(params.db); From 45b03a1e3672f3ebd60b47fabc80d2add948972c Mon Sep 17 00:00:00 2001 From: morningman Date: Wed, 25 Oct 2023 13:00:55 +0800 Subject: [PATCH 2/2] 1 --- regression-test/pipeline/external/conf/fe.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/regression-test/pipeline/external/conf/fe.conf b/regression-test/pipeline/external/conf/fe.conf index adc042357ca572..1766cf1ddb6698 100644 --- a/regression-test/pipeline/external/conf/fe.conf +++ b/regression-test/pipeline/external/conf/fe.conf @@ -87,3 +87,4 @@ dynamic_partition_check_interval_seconds=3 enable_feature_binlog=true auth_token = 5ff161c3-2c08-4079-b108-26c8850b6598 +infodb_support_ext_catalog=true