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 f2549a4097c branch-3.1: [fix](filecache) using invalid memory crashes
clear_need_update_lru_blocks #58768 (#58819)
f2549a4097c is described below
commit f2549a4097c29ae33ba48cb2ad8e756f8ff030ae
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Dec 9 15:02:55 2025 +0800
branch-3.1: [fix](filecache) using invalid memory crashes
clear_need_update_lru_blocks #58768 (#58819)
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 648e815ade6..6b2741368c4 100644
--- a/be/src/io/cache/block_file_cache.cpp
+++ b/be/src/io/cache/block_file_cache.cpp
@@ -2261,9 +2261,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]