This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new ad6a4130c00 [cherry-pick](branch-3.0)[Bug] test suite 
test_table_options may cause NPE in FE (#39509)(#39742)
ad6a4130c00 is described below

commit ad6a4130c00353f253ebeaccc4268fd181b3fb7b
Author: Vallish Pai <[email protected]>
AuthorDate: Thu Aug 22 07:16:10 2024 +0530

    [cherry-pick](branch-3.0)[Bug] test suite test_table_options may cause NPE 
in FE (#39509)(#39742)
    
    
    
    backport #39509
---
 .../apache/doris/tablefunction/MetadataGenerator.java  | 18 ++++++++++++++++++
 1 file changed, 18 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 10a8e1cc5ad..6a122d6640b 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
@@ -1135,6 +1135,15 @@ public class MetadataGenerator {
         String clg = params.getCatalog();
         CatalogIf catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(clg);
         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<TableIf> tables = database.getTables();
         if (catalog instanceof InternalCatalog) {
             tableOptionsForInternalCatalog(currentUserIdentity, catalog, 
database, tables, dataBatch);
@@ -1222,6 +1231,15 @@ public class MetadataGenerator {
         CatalogIf catalog = 
Env.getCurrentEnv().getCatalogMgr().getCatalog(clg);
         List<TRow> 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<TableIf> tables = database.getTables();
         if (catalog instanceof InternalCatalog) {
             tablePropertiesForInternalCatalog(currentUserIdentity, catalog, 
database, tables, dataBatch);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to