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

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


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 1752204cd7f branch-3.1: [enhancement](filecache) parallel clear cache 
between multiple cache instance #55259 (#55437)
1752204cd7f is described below

commit 1752204cd7f2fa3f9261d3b6fb867e82702372bc
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Sep 4 09:55:55 2025 +0800

    branch-3.1: [enhancement](filecache) parallel clear cache between multiple 
cache instance #55259 (#55437)
    
    Cherry-picked from #55259
    
    Signed-off-by: zhengyu <[email protected]>
    Co-authored-by: zhengyu <[email protected]>
---
 be/src/io/cache/block_file_cache_factory.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/be/src/io/cache/block_file_cache_factory.cpp 
b/be/src/io/cache/block_file_cache_factory.cpp
index d43e3acea14..1d29196c240 100644
--- a/be/src/io/cache/block_file_cache_factory.cpp
+++ b/be/src/io/cache/block_file_cache_factory.cpp
@@ -31,6 +31,7 @@
 #endif
 
 #include <algorithm>
+#include <execution>
 #include <ostream>
 #include <utility>
 
@@ -156,9 +157,17 @@ FileCacheFactory::get_query_context_holders(const 
TUniqueId& query_id) {
 }
 
 std::string FileCacheFactory::clear_file_caches(bool sync) {
+    std::vector<std::string> results(_caches.size());
+
+    std::for_each(std::execution::par, _caches.begin(), _caches.end(), 
[&](const auto& cache) {
+        size_t index = &cache - &_caches[0];
+        results[index] =
+                sync ? cache->clear_file_cache_directly() : 
cache->clear_file_cache_async();
+    });
+
     std::stringstream ss;
-    for (const auto& cache : _caches) {
-        ss << (sync ? cache->clear_file_cache_directly() : 
cache->clear_file_cache_async()) << "\n";
+    for (const auto& result : results) {
+        ss << result << "\n";
     }
     return ss.str();
 }


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

Reply via email to