freemandealer opened a new pull request, #65434:
URL: https://github.com/apache/doris/pull/65434
### 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.
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [x] 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 <!-- Add your reason? -->
Unit test on source PR branch:
```bash
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.
Pick validation on master:
```bash
git diff --check HEAD~1..HEAD --
be/src/io/cache/block_file_cache_ttl_mgr.cpp
be/test/io/cache/block_file_cache_ttl_mgr_test.cpp
clang-format --dry-run --Werror be/src/io/cache/block_file_cache_ttl_mgr.cpp
be/test/io/cache/block_file_cache_ttl_mgr_test.cpp
```
- Behavior changed:
- [ ] No.
- [x] Yes. Registered ordinary non-TTL tablets no longer scan cached
blocks in every TTL manager update round.
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]