This is an automated email from the ASF dual-hosted git repository.
dataroaring 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 858aaf0ec8c branch-3.0: [fix](cloud) release fd after clear file cache
#50555 (#50893)
858aaf0ec8c is described below
commit 858aaf0ec8c64910b0e0549fe61273f84e403027
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed May 14 20:56:38 2025 +0800
branch-3.0: [fix](cloud) release fd after clear file cache #50555 (#50893)
Cherry-picked from #50555
Signed-off-by: zhengyu <[email protected]>
Co-authored-by: zhengyu <[email protected]>
---
be/src/io/cache/block_file_cache.cpp | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/be/src/io/cache/block_file_cache.cpp
b/be/src/io/cache/block_file_cache.cpp
index bad789016ca..39e1a4ae28a 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -2077,6 +2077,19 @@ std::string BlockFileCache::clear_file_cache_directly() {
int64_t normal_queue_size = _normal_queue.get_elements_num(cache_lock);
int64_t disposible_queue_size =
_disposable_queue.get_elements_num(cache_lock);
int64_t ttl_queue_size = _ttl_queue.get_elements_num(cache_lock);
+
+ int64_t clear_fd_duration = 0;
+ {
+ // clear FDCache to release fd
+ SCOPED_RAW_TIMER(&clear_fd_duration);
+ for (const auto& [file_key, file_blocks] : _files) {
+ for (const auto& [offset, file_block_cell] : file_blocks) {
+ AccessKeyAndOffset access_key_and_offset(file_key, offset);
+ FDCache::instance()->remove_file_reader(access_key_and_offset);
+ }
+ }
+ }
+
_files.clear();
_cur_cache_size = 0;
_cur_ttl_size = 0;
@@ -2088,9 +2101,10 @@ std::string BlockFileCache::clear_file_cache_directly() {
_ttl_queue.clear(cache_lock);
ss << "finish clear_file_cache_directly"
<< " path=" << _cache_base_path
- << " time_elapsed=" << duration_cast<milliseconds>(steady_clock::now()
- start).count()
- << " num_files=" << num_files << " cache_size=" << cache_size
- << " index_queue_size=" << index_queue_size << " normal_queue_size=" <<
normal_queue_size
+ << " time_elapsed_ms=" <<
duration_cast<milliseconds>(steady_clock::now() - start).count()
+ << " fd_clear_time_ms=" << (clear_fd_duration / 1000000) << "
num_files=" << num_files
+ << " cache_size=" << cache_size << " index_queue_size=" <<
index_queue_size
+ << " normal_queue_size=" << normal_queue_size
<< " disposible_queue_size=" << disposible_queue_size <<
"ttl_queue_size=" << ttl_queue_size;
auto msg = ss.str();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]