Skip to content

Conversation

@freemandealer
Copy link
Contributor

  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

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

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>
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

Signed-off-by: zhengyu <zhangzhengyu@selectdb.com>
@freemandealer
Copy link
Contributor Author

run buildall


LOG_INFO("Start clear file cache async").tag("path", _cache_base_path);
auto iter_queue = [&](LRUQueue& queue) {
bool end = false;
Copy link
Contributor

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;
Copy link
Contributor

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) {
Copy link
Contributor

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() {
Copy link
Contributor

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

@freemandealer
Copy link
Contributor Author

updated in new PR: #46561

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants