From 42f30d4a487b484b1c97780b97be8bec35c093ba Mon Sep 17 00:00:00 2001 From: wangbo Date: Wed, 28 Aug 2024 14:17:00 +0800 Subject: [PATCH] [branch-2.1][Bug] test suite test_table_options may cause NPE in FE #39457 (#39509) (#40018) ## Proposed changes pick #39509 Co-authored-by: Vallish Pai --- .../apache/doris/tablefunction/MetadataGenerator.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 0c928fd838ba2f..c8105a81dcf743 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 @@ private static TFetchSchemaTableDataResult tablePropertiesMetadataResult(TSchema 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);