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 813a6977b7b [bugfix](hive)fix testcase for viewfs (#34790)
813a6977b7b is described below

commit 813a6977b7babe4284a371b6972b82a05afdc86d
Author: wuwenchi <wuwenchi...@hotmail.com>
AuthorDate: Fri May 17 16:06:13 2024 +0800

    [bugfix](hive)fix testcase for viewfs (#34790)
    
    The specified `fsname` is used first, and if there is no `fsname`, the 
default `fsname` is used.
    Because we create an HDFS cache based on the actual `fsname`.
---
 be/src/io/hdfs_util.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/be/src/io/hdfs_util.cpp b/be/src/io/hdfs_util.cpp
index 02b6fadb310..42353fb481f 100644
--- a/be/src/io/hdfs_util.cpp
+++ b/be/src/io/hdfs_util.cpp
@@ -41,10 +41,13 @@ Status create_hdfs_fs(const THdfsParams& hdfs_params, const 
std::string& fs_name
     return Status::OK();
 }
 
-uint64 hdfs_hash_code(const THdfsParams& hdfs_params) {
+uint64 hdfs_hash_code(const THdfsParams& hdfs_params, const std::string& 
fs_name) {
     uint64 hash_code = 0;
-    hash_code ^= Fingerprint(hdfs_params.fs_name);
-    if (hdfs_params.__isset.user) {
+    // The specified fsname is used first.
+    // If there is no specified fsname, the default fsname is used
+    if (!fs_name.empty()) {
+        hash_code ^= Fingerprint(fs_name);
+    } else if (hdfs_params.__isset.user) {
         hash_code ^= Fingerprint(hdfs_params.user);
     }
     if (hdfs_params.__isset.hdfs_kerberos_principal) {
@@ -105,7 +108,7 @@ void HdfsHandlerCache::_clean_oldest() {
 
 Status HdfsHandlerCache::get_connection(const THdfsParams& hdfs_params, const 
std::string& fs_name,
                                         std::shared_ptr<HdfsHandler>* 
fs_handle) {
-    uint64 hash_code = hdfs_hash_code(hdfs_params);
+    uint64 hash_code = hdfs_hash_code(hdfs_params, fs_name);
     {
         std::lock_guard<std::mutex> l(_lock);
         auto it = _cache.find(hash_code);


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

Reply via email to