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

dataroaring 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 a8214dbdbb9 [fix](Cloud) Carry properties with storage vault (#33065)
a8214dbdbb9 is described below

commit a8214dbdbb95f18f9fb632f4306fd3b5ea3a7d40
Author: AlexYue <[email protected]>
AuthorDate: Sat Mar 30 19:08:21 2024 +0800

    [fix](Cloud) Carry properties with storage vault (#33065)
    
    Co-authored-by: Yongqiang YANG 
<[email protected]>
---
 .../org/apache/doris/analysis/CreateStorageVaultStmt.java | 12 ++++++++----
 .../main/java/org/apache/doris/catalog/StorageVault.java  |  1 +
 .../apache/doris/cloud/catalog/HdfsStorageVaultTest.java  | 15 ++++++++++-----
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateStorageVaultStmt.java
 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateStorageVaultStmt.java
index f5c8ad33476..a606ed48336 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateStorageVaultStmt.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CreateStorageVaultStmt.java
@@ -63,6 +63,13 @@ public class CreateStorageVaultStmt extends DdlStmt {
         return vaultType;
     }
 
+    public void setStorageVaultType(StorageVault.StorageVaultType type) throws 
UserException {
+        if (type == StorageVault.StorageVaultType.UNKNOWN) {
+            throw new AnalysisException("Unsupported Storage Vault type: " + 
type);
+        }
+        this.vaultType = type;
+    }
+
     @Override
     public void analyze(Analyzer analyzer) throws UserException {
         super.analyze(analyzer);
@@ -83,10 +90,7 @@ public class CreateStorageVaultStmt extends DdlStmt {
         if (type == null) {
             throw new AnalysisException("Storage Vault type can't be null");
         }
-        vaultType = StorageVault.StorageVaultType.fromString(type);
-        if (vaultType == StorageVault.StorageVaultType.UNKNOWN) {
-            throw new AnalysisException("Unsupported Storage Vault type: " + 
type);
-        }
+        setStorageVaultType(StorageVault.StorageVaultType.fromString(type));
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/StorageVault.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/StorageVault.java
index f6e0525d17b..bd8871ef77f 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/StorageVault.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/StorageVault.java
@@ -119,6 +119,7 @@ public abstract class StorageVault {
             default:
                 throw new DdlException("Unknown StorageVault type: " + type);
         }
+        vault.modifyProperties(stmt.getProperties());
 
         return vault;
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/cloud/catalog/HdfsStorageVaultTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/cloud/catalog/HdfsStorageVaultTest.java
index 0baa459b97a..9c62e357161 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/cloud/catalog/HdfsStorageVaultTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/cloud/catalog/HdfsStorageVaultTest.java
@@ -17,7 +17,7 @@
 
 package org.apache.doris.cloud.catalog;
 
-
+import org.apache.doris.analysis.CreateStorageVaultStmt;
 import org.apache.doris.catalog.HdfsStorageVault;
 import org.apache.doris.catalog.StorageVault;
 import org.apache.doris.catalog.StorageVaultMgr;
@@ -49,9 +49,10 @@ public class HdfsStorageVaultTest {
         Config.meta_service_endpoint = "127.0.0.1:20121";
     }
 
-    StorageVault createHdfsVault(String name, Map<String, String> properties) 
throws DdlException {
-        HdfsStorageVault vault = new HdfsStorageVault(name, false);
-        vault.modifyProperties(properties);
+    StorageVault createHdfsVault(String name, Map<String, String> properties) 
throws Exception {
+        CreateStorageVaultStmt stmt = new CreateStorageVaultStmt(false, name, 
properties);
+        stmt.setStorageVaultType(StorageVault.StorageVaultType.HDFS);
+        StorageVault vault = StorageVault.fromStmt(stmt);
         return vault;
     }
 
@@ -69,7 +70,11 @@ public class HdfsStorageVaultTest {
         };
         StorageVault vault = createHdfsVault("hdfs", ImmutableMap.of(
                 "type", "hdfs",
-                "path", "abs/"));
+                "path", "abs/",
+                HdfsStorageVault.HADOOP_FS_NAME, "default"));
+        Map<String, String> properties = vault.getCopiedProperties();
+        // To check if the properties is carried correctly
+        
Assertions.assertEquals(properties.get(HdfsStorageVault.HADOOP_FS_NAME), 
"default");
         mgr.createHdfsVault(vault);
     }
 


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

Reply via email to