-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](cloud) fix file cache potential leakage #46404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1. fix compaction gc leakage by correcting use_count() of rowset shr_ptr 2. seperate monitoring and gc routine in blockfilecache backgroud thread to avoid interference 3. update BlockFileCache::recycle_deleted_blocks flow control for gc efficiency 4. refactor: unify stale async cache clean to orginal tag-and-deleting 5. fix leakage in remove_if_cached_async in case of !releasable 6. fix leakage in BlockFileCache::remove in case of FileBlock::State::DOWNLOADING 7. TODO: add more cases Signed-off-by: zhengyu <zhangzhengyu@selectdb.com>
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Signed-off-by: zhengyu <zhangzhengyu@selectdb.com>
|
run buildall |
|
|
||
| LOG_INFO("Start clear file cache async").tag("path", _cache_base_path); | ||
| auto iter_queue = [&](LRUQueue& queue) { | ||
| bool end = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is end set to true?
| void BlockFileCache::recycle_deleted_blocks() { | ||
| using namespace std::chrono; | ||
| static int remove_batch = 100; | ||
| static int remove_batch = 500; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep it 100, and make the cond.wait_for(cache_lock, std::chrono::microseconds(100)); configurable to do throttle.
| bool end = false; | ||
| while (queue.get_capacity(cache_lock) != 0 && !end) { | ||
| std::vector<FileBlockCell*> cells; | ||
| for (const auto& [entry_key, entry_offset, _] : queue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that we should not iterate from the beginning again?
there may be performance penalty if there are lots of running query while we are deleting elements that are far from the head.
can we iterate from rbegin() to get better performance?
| return msg; | ||
| } | ||
|
|
||
| void BlockFileCache::recycle_deleted_blocks() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UT should be added to make it fully tested
|
updated in new PR: #46561 |
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)