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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 47aa53fa72 [fix](multi-catalog)switching catalogs after dropping will 
get NPE. (#16067)
47aa53fa72 is described below

commit 47aa53fa72ab7bebfcf16bcfe9a63b873cbcbc18
Author: qiye <[email protected]>
AuthorDate: Thu Jan 19 15:13:21 2023 +0800

    [fix](multi-catalog)switching catalogs after dropping will get NPE. (#16067)
    
    Issue Number: close #16066
---
 fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index 213ab7d7e6..3b33e7d50d 100755
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -4357,7 +4357,10 @@ public class Env {
 
         String currentDB = ctx.getDatabase();
         if (StringUtils.isNotEmpty(currentDB)) {
-            catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), 
currentDB);
+            // When dropped the current catalog in current context, the 
current catalog will be null.
+            if (ctx.getCurrentCatalog() != null) {
+                
catalogMgr.addLastDBOfCatalog(ctx.getCurrentCatalog().getName(), currentDB);
+            }
         }
         ctx.changeDefaultCatalog(catalogName);
         String lastDb = catalogMgr.getLastDB(catalogName);


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

Reply via email to