Skip to content

branch-4.1: [fix](filecache) skip redundant ttl scans for non-TTL tablets (pick #65434) - #65429

Merged
yiguolei merged 1 commit into
apache:branch-4.1from
freemandealer:task-branch-4-1-ttl-mgr-update-cpu
Jul 11, 2026
Merged

branch-4.1: [fix](filecache) skip redundant ttl scans for non-TTL tablets (pick #65434)#65429
yiguolei merged 1 commit into
apache:branch-4.1from
freemandealer:task-branch-4-1-ttl-mgr-update-cpu

Conversation

@freemandealer

@freemandealerfreemandealer commented Jul 9, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:

The file cache TTL manager keeps registered tablet ids in _tablet_id_set. For ordinary non-TTL tablets, the old ttl_seconds <= 0 path always set need_convert_from_ttl = true, so every update round scanned cached blocks even when the tablet had never been recorded in _ttl_info_map.

This PR reduces the repeated CPU work for registered non-TTL tablets:

  • If a tablet was previously tracked as TTL, it is still converted back to NORMAL immediately when TTL is disabled.
  • If a tablet has no prior TTL info, the manager skips the per-round cached block scan.
  • A low-frequency reconciliation scan is kept every 20 update rounds, so cleanup behavior is preserved while avoiding scans on every round.

With the default file_cache_background_ttl_info_update_interval_ms = 180000, ordinary non-TTL tablets avoid the repeated per-round block scan that previously ran every 3 minutes.

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

Unit test:

DORIS_TOOLCHAIN=clang DISABLE_BE_JAVA_EXTENSIONS=ON ENABLE_INJECTION_POINT=ON ENABLE_CACHE_LOCK_DEBUG=0 ENABLE_PCH=0 sh run-be-ut.sh --run --filter='BlockFileCacheTtlMgrTest.*'

Result: 5 tests passed.

  • Behavior changed:

    • No.
    • Yes. Registered ordinary non-TTL tablets no longer scan cached blocks in every TTL manager update round.
  • 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

@hello-stephen

Copy link
Copy Markdown
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?

@freemandealer

Copy link
Copy Markdown
MemberAuthor

run buildall

@freemandealer

Copy link
Copy Markdown
MemberAuthor

/review

@freemandealerfreemandealer changed the title [fix](file cache) skip redundant ttl scans for non-TTL tablets[fix](filecache) skip redundant ttl scans for non-TTL tabletsJul 9, 2026

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for one file-cache TTL correctness issue.

Critical checkpoints:

  • Changed files reviewed: be/src/io/cache/block_file_cache_ttl_mgr.cpp and be/test/io/cache/block_file_cache_ttl_mgr_test.cpp, plus relevant cache load and cache-type transition paths.
  • Existing review context: no existing inline review threads or replies were present, so this is not a duplicate.
  • User focus: no additional user-provided review focus.
  • Repo instructions: no AGENTS.md files were listed; a repo-local code-review SKILL.md was not present in the expected paths, so I followed the review prompt and ledger workflow.
  • Subagent conclusions: optimizer-rewrite produced no candidates and was dismissed with evidence; tests-session-config produced main-001, accepted as the inline comment below; convergence round 1 ended with both subagents replying NO_NEW_VALUABLE_FINDINGS for the same ledger/comment set.
  • Validation: static review only. The checkout is grafted and missing the base object for local diff checks, and thirdparty/installed plus thirdparty/installed/bin/protoc are absent, so I did not run BE unit tests.

Comment threadbe/src/io/cache/block_file_cache_ttl_mgr.cpp Outdated
@freemandealer
freemandealerforce-pushed the task-branch-4-1-ttl-mgr-update-cpu branch from 35323a5 to 7ae7df1CompareJuly 9, 2026 15:11
@freemandealer

Copy link
Copy Markdown
MemberAuthor

/review

@freemandealer

Copy link
Copy Markdown
MemberAuthor

run buildall

github-actions[bot]
github-actionsBot previously requested changes Jul 9, 2026

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review result: request changes.

Critical checkpoints:

  • Scope: live PR head 7ae7df1; GitHub reports two changed files: be/src/io/cache/block_file_cache_ttl_mgr.cpp and be/test/io/cache/block_file_cache_ttl_mgr_test.cpp.
  • Existing review context: I considered the existing restart/persisted-TTL thread. The inline comment below is a distinct current-patch follow-up because the new periodic reconcile addresses the old _ttl_info_map gate but still depends on missing tablet-id registration.
  • User focus: no additional user-provided review focus was supplied.
  • Validation: git show --format= --check HEAD -- be/src/io/cache/block_file_cache_ttl_mgr.cpp be/test/io/cache/block_file_cache_ttl_mgr_test.cpp passed. I did not run the BE unit test locally because this grafted checkout is missing thirdparty/installed and thirdparty/installed/bin/protoc; the PR body reports the author's BlockFileCacheTtlMgrTest run.

Subagent conclusions:

  • optimizer-rewrite proposed optimizer-rewrite-001, accepted as inline-001.
  • tests-session-config proposed tests-session-config-001, merged as duplicate/supporting evidence for inline-001 rather than a second comment.
  • Convergence round 1 ended with both live subagents reporting NO_NEW_VALUABLE_FINDINGS for the same final ledger/comment set.

Comment threadbe/src/io/cache/block_file_cache_ttl_mgr.cpp
@freemandealer

Copy link
Copy Markdown
MemberAuthor

run beut

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (6/6) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage54.78% (20953/38252)
Line Coverage38.21% (199977/523352)
Region Coverage34.68% (156981/452697)
Branch Coverage35.63% (68530/192361)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (6/6) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.81% (27587/37375)
Line Coverage57.44% (299159/520851)
Region Coverage55.03% (250798/455783)
Branch Coverage56.39% (108632/192653)

@freemandealerfreemandealer changed the title [fix](filecache) skip redundant ttl scans for non-TTL tabletsbranch-4.1: [fix](filecache) skip redundant ttl scans for non-TTL tabletsJul 10, 2026
@freemandealerfreemandealer changed the title branch-4.1: [fix](filecache) skip redundant ttl scans for non-TTL tabletsbranch-4.1: [fix](filecache) skip redundant ttl scans for non-TTL tablets (pick #65434)Jul 10, 2026
@yiguolei
yiguolei merged commit 4e0b722 into apache:branch-4.1Jul 11, 2026
36 of 39 checks passed
liaoxin01 pushed a commit that referenced this pull request Jul 14, 2026
### What problem does this PR solve?
Issue Number: None
Related PR: #65429
Problem Summary:
Pick #65429 to master.
The file cache TTL manager keeps registered tablet ids in
`_tablet_id_set`. For ordinary non-TTL tablets, the old `ttl_seconds <=
0` path always set `need_convert_from_ttl = true`, so every update round
scanned cached blocks even when the tablet had never been recorded in
`_ttl_info_map`.
This PR reduces the repeated CPU work for registered non-TTL tablets:
- If a tablet was previously tracked as TTL, it is still converted back
to NORMAL immediately when TTL is disabled.
- If a tablet has no prior TTL info, the manager skips the per-round
cached block scan.
- A low-frequency reconciliation scan is kept every 20 update rounds, so
cleanup behavior is preserved while avoiding scans on every round.
With the default `file_cache_background_ttl_info_update_interval_ms =
180000`, ordinary non-TTL tablets avoid the repeated per-round block
scan that previously ran every 3 minutes.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@freemandealer@hello-stephen@yiguolei