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

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


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new c5480558877 [fix](cloud) serialize cache init to avoid unstable cache 
pick (#44429) (#44942)
c5480558877 is described below

commit c548055887789b45a9b15abdf374efbb53733e11
Author: zhengyu <zhangzhen...@selectdb.com>
AuthorDate: Wed Jan 1 13:53:22 2025 +0800

    [fix](cloud) serialize cache init to avoid unstable cache pick (#44429) 
(#44942)
---
 be/src/runtime/exec_env_init.cpp | 31 ++++++++++++-------------------
 1 file changed, 12 insertions(+), 19 deletions(-)

diff --git a/be/src/runtime/exec_env_init.cpp b/be/src/runtime/exec_env_init.cpp
index 81bdf867728..d5ae233c6c7 100644
--- a/be/src/runtime/exec_env_init.cpp
+++ b/be/src/runtime/exec_env_init.cpp
@@ -424,33 +424,26 @@ void 
ExecEnv::init_file_cache_factory(std::vector<doris::CachePath>& cache_paths
                    << ", reason=" << rest.msg();
         exit(-1);
     }
-    std::vector<std::thread> file_cache_init_threads;
 
-    std::list<doris::Status> cache_status;
+    doris::Status cache_status;
     for (auto& cache_path : cache_paths) {
         if (cache_path_set.find(cache_path.path) != cache_path_set.end()) {
             LOG(WARNING) << fmt::format("cache path {} is duplicate", 
cache_path.path);
             continue;
         }
 
-        file_cache_init_threads.emplace_back([&, status = 
&cache_status.emplace_back()]() {
-            *status = 
doris::io::FileCacheFactory::instance()->create_file_cache(
-                    cache_path.path, cache_path.init_settings());
-        });
-
-        cache_path_set.emplace(cache_path.path);
-    }
-
-    for (std::thread& thread : file_cache_init_threads) {
-        if (thread.joinable()) {
-            thread.join();
-        }
-    }
-    for (const auto& status : cache_status) {
-        if (!status.ok()) {
-            LOG(FATAL) << "failed to init file cache, err: " << status;
-            exit(-1);
+        cache_status = 
doris::io::FileCacheFactory::instance()->create_file_cache(
+                cache_path.path, cache_path.init_settings());
+        if (!cache_status.ok()) {
+            if (!doris::config::ignore_broken_disk) {
+                LOG(FATAL) << "failed to init file cache, path: " << 
cache_path.path
+                           << " err: " << cache_status;
+                exit(-1);
+            }
+            LOG(WARNING) << "failed to init file cache, path: " << 
cache_path.path
+                         << " err: " << cache_status;
         }
+        cache_path_set.emplace(cache_path.path);
     }
 }
 


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

Reply via email to