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

plat1ko 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 7cd7d4902eb [feature](Cloud) Generate one suffix to distinguish 
different hdfs root path (#33411)
7cd7d4902eb is described below

commit 7cd7d4902eb9d6a54f7cf1b5b95693c7d9df639e
Author: AlexYue <yj976240...@gmail.com>
AuthorDate: Tue Apr 9 16:52:54 2024 +0800

    [feature](Cloud) Generate one suffix to distinguish different hdfs root 
path (#33411)
---
 cloud/src/common/config.h                        |  2 ++
 cloud/src/meta-service/meta_service_resource.cpp | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/cloud/src/common/config.h b/cloud/src/common/config.h
index 41e8529dbf0..5640aef2cf9 100644
--- a/cloud/src/common/config.h
+++ b/cloud/src/common/config.h
@@ -165,4 +165,6 @@ CONF_String(kerberos_ccache_path, "");
 // set krb5.conf path, use "/etc/krb5.conf" by default
 CONF_String(kerberos_krb5_conf_path, "/etc/krb5.conf");
 
+CONF_mBool(enable_distinguish_hdfs_path, "true");
+
 } // namespace doris::cloud::config
diff --git a/cloud/src/meta-service/meta_service_resource.cpp 
b/cloud/src/meta-service/meta_service_resource.cpp
index 82056a5172c..f4f8c944c7b 100644
--- a/cloud/src/meta-service/meta_service_resource.cpp
+++ b/cloud/src/meta-service/meta_service_resource.cpp
@@ -16,6 +16,7 @@
 // under the License.
 
 #include <brpc/channel.h>
+#include <butil/guid.h>
 #include <fmt/core.h>
 #include <gen_cpp/cloud.pb.h>
 
@@ -384,6 +385,15 @@ static int add_hdfs_storage_vault(InstanceInfoPB& 
instance, Transaction* txn,
         msg = fmt::format("invalid prefix: ", *prefix);
         return -1;
     }
+    if (config::enable_distinguish_hdfs_path) {
+        auto uuid_suffix = butil::GenerateGUID();
+        if (uuid_suffix.empty()) [[unlikely]] {
+            code = MetaServiceCode::UNDEFINED_ERR;
+            msg = fmt::format("failed to generate one suffix for hdfs prefix");
+            return -1;
+        }
+        *prefix = fmt::format("{}_{}", *prefix, uuid_suffix);
+    }
 
     auto* fs_name = 
hdfs_param.mutable_hdfs_info()->mutable_build_conf()->mutable_fs_name();
     if (!normalize_hdfs_fs_name(*fs_name)) {


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

Reply via email to