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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 54592d048a0 [fix](multicatalog) fix npe issue when alter property for 
a non-exist catalog (#36951)
54592d048a0 is described below

commit 54592d048a0c3e0eff698d0c8a062f9e382063db
Author: Yulei-Yang <yulei.yang0...@gmail.com>
AuthorDate: Fri Jun 28 18:52:43 2024 +0800

    [fix](multicatalog) fix npe issue when alter property for a non-exist 
catalog (#36951)
---
 fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java  | 2 +-
 .../suites/external_table_p2/hive/test_external_catalog_hive.groovy   | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java 
b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
index d0c8f91800d..ac809812260 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/CatalogMgr.java
@@ -348,10 +348,10 @@ public class CatalogMgr implements Writable, 
GsonPostProcessable {
         writeLock();
         try {
             CatalogIf catalog = nameToCatalog.get(stmt.getCatalogName());
-            Map<String, String> oldProperties = catalog.getProperties();
             if (catalog == null) {
                 throw new DdlException("No catalog found with name: " + 
stmt.getCatalogName());
             }
+            Map<String, String> oldProperties = catalog.getProperties();
             if (stmt.getNewProperties().containsKey("type") && 
!catalog.getType()
                     .equalsIgnoreCase(stmt.getNewProperties().get("type"))) {
                 throw new DdlException("Can't modify the type of catalog 
property with name: " + stmt.getCatalogName());
diff --git 
a/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
 
b/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
index ef2b5a32e42..45b0b7dc9ca 100644
--- 
a/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
+++ 
b/regression-test/suites/external_table_p2/hive/test_external_catalog_hive.groovy
@@ -152,5 +152,9 @@ suite("test_external_catalog_hive", "p2") {
             """
             exception "Failed to init access controller: bound must be 
positive"
         }
+
+       sql """DROP CATALOG if exists ctl_not_exist_not_exist"""
+        def res4 = sql """ALTER CATALOG ctl_not_exist_not_exist SET PROPERTIES 
('s3.access_key' = 'xxxx')"""
+        assertTrue(res4.contains("No catalog found with name"))
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to