Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions be/src/io/cache/block_file_cache_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#endif

#include <algorithm>
#include <execution>
#include <ostream>
#include <utility>

Expand Down Expand Up @@ -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();
}
Expand Down
Loading