You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2025/10/10 09:19:55 UTC
(doris) branch branch-3.1 updated: branch-3.1: [fix](filecache) fix crash when clear file cache #56170 (#56584)
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 ed2ed5b3a7c branch-3.1: [fix](filecache) fix crash when clear file cache #56170 (#56584)
ed2ed5b3a7c is described below
commit ed2ed5b3a7c3162ccf383c11960f044081d9b7c2
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Fri Oct 10 17:19:47 2025 +0800
branch-3.1: [fix](filecache) fix crash when clear file cache #56170 (#56584)
Cherry-picked from #56170
Signed-off-by: zhengyu <zh...@selectdb.com>
Co-authored-by: zhengyu <zh...@selectdb.com>
---
be/src/io/cache/block_file_cache.cpp | 12 ++++++++++++
be/src/io/cache/block_file_cache.h | 2 ++
2 files changed, 14 insertions(+)
diff --git a/be/src/io/cache/block_file_cache.cpp b/be/src/io/cache/block_file_cache.cpp
index 6f3b3061990..648e815ade6 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -662,7 +662,9 @@ std::string BlockFileCache::clear_file_cache_async() {
++num_cells_to_delete;
}
}
+ clear_need_update_lru_blocks();
}
+
std::stringstream ss;
ss << "finish clear_file_cache_async, path=" << _cache_base_path
<< " num_files_all=" << num_files_all << " num_cells_all=" << num_cells_all
@@ -2258,6 +2260,13 @@ bool BlockFileCache::try_reserve_during_async_load(size_t size,
return !_disk_resource_limit_mode || removed_size >= size;
}
+void BlockFileCache::clear_need_update_lru_blocks() {
+ std::vector<FileBlockSPtr> buffer;
+ buffer.reserve(1024);
+ while (_need_update_lru_blocks.try_dequeue_bulk(buffer.data(), buffer.capacity())) {
+ }
+}
+
std::string BlockFileCache::clear_file_cache_directly() {
_lru_dumper->remove_lru_dump_files();
using namespace std::chrono;
@@ -2300,6 +2309,9 @@ std::string BlockFileCache::clear_file_cache_directly() {
_normal_queue.clear(cache_lock);
_disposable_queue.clear(cache_lock);
_ttl_queue.clear(cache_lock);
+
+ clear_need_update_lru_blocks();
+
ss << "finish clear_file_cache_directly"
<< " path=" << _cache_base_path
<< " time_elapsed_ms=" << duration_cast<milliseconds>(steady_clock::now() - start).count()
diff --git a/be/src/io/cache/block_file_cache.h b/be/src/io/cache/block_file_cache.h
index e8e768f7ce2..e17b0ba3715 100644
--- a/be/src/io/cache/block_file_cache.h
+++ b/be/src/io/cache/block_file_cache.h
@@ -453,6 +453,8 @@ private:
size_t& offset, size_t& size);
void remove_lru_dump_files();
+ void clear_need_update_lru_blocks();
+
// info
std::string _cache_base_path;
size_t _capacity = 0;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org