diff --git a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java index 0c928fd838..c8105a81dc 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java @@ -1105,6 +1105,15 @@ public class MetadataGenerator { CatalogIf catalog = Env.getCurrentEnv().getCatalogMgr().getCatalog(clg); List dataBatch = Lists.newArrayList(); DatabaseIf database = catalog.getDbNullable(dbId); + if (database == null) { + // BE gets the database id list from FE and then invokes this interface + // per database. there is a chance that in between database can be dropped. + // so need to handle database not exist case and return ok so that BE continue the + // loop with next database. + result.setDataBatch(dataBatch); + result.setStatus(new TStatus(TStatusCode.OK)); + return result; + } List tables = database.getTables(); if (catalog instanceof InternalCatalog) { tablePropertiesForInternalCatalog(currentUserIdentity, catalog, database, tables, dataBatch);