This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 66de1e460c6 branch-4.0: [fix](filecache) using invalid memory crashes
clear_need_update_lru_blocks #58768 (#58820)
66de1e460c6 is described below
commit 66de1e460c6fd81ad49f6d0ea179f2f36b951d6c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 9 16:43:27 2025 +0800
branch-4.0: [fix](filecache) using invalid memory crashes
clear_need_update_lru_blocks #58768 (#58820)
Cherry-picked from #58768
Co-authored-by: zhengyu <[email protected]>
---
be/src/io/cache/block_file_cache.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/be/src/io/cache/block_file_cache.cpp
b/be/src/io/cache/block_file_cache.cpp
index fcfa2bda9e7..22608c84ba9 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -2268,9 +2268,13 @@ bool
BlockFileCache::try_reserve_during_async_load(size_t 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())) {
+ constexpr size_t kBatchSize = 1024;
+ std::vector<FileBlockSPtr> buffer(kBatchSize);
+ size_t drained = 0;
+ while ((drained = _need_update_lru_blocks.try_dequeue_bulk(buffer.data(),
buffer.size())) > 0) {
+ for (size_t i = 0; i < drained; ++i) {
+ buffer[i].reset();
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]