columnar: gc ia meta & schema files in cloud_helper - #10988
Conversation
Signed-off-by: yongman <yming0221@gmail.com>
|
Skipping CI for Draft Pull Request. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughSchema-file cache recency tracking and global eviction are added to ChangesRuntime garbage collection
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant EngineStoreLifecycle
participant BackgroundGCLoop
participant IAMetaFiles
participant CloudHelper
EngineStoreLifecycle->>BackgroundGCLoop: start when gc_interval is non-zero
BackgroundGCLoop->>IAMetaFiles: run IA metadata GC
BackgroundGCLoop->>CloudHelper: gc_schema_file_cache()
CloudHelper->>CloudHelper: prune and evict schema-file entries
EngineStoreLifecycle->>BackgroundGCLoop: set service_shutdown
BackgroundGCLoop-->>EngineStoreLifecycle: exit and join
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: yongman <yming0221@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@contrib/tiflash-columnar-hub/hub-runtime/src/cloud_helper.rs`:
- Around line 1390-1399: Update the cache-state insertion in the
latest_by_keyspace loop to capture the current access_seq and assign it to
last_access_seq for newly discovered keyspaces instead of 0. Keep existing
entries’ latest_version updates unchanged, so freshly loaded keyspaces are
treated as recently accessed during gc_schema_file_cache_global eviction.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9faf5786-67f3-4e03-b576-cc762b795186
📒 Files selected for processing (2)
contrib/tiflash-columnar-hub/hub-runtime/src/cloud_helper.rscontrib/tiflash-columnar-hub/hub-runtime/src/run.rs
Signed-off-by: yongman <yming0221@gmail.com>
|
/test pull-integration-test |
|
/hold |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
contrib/tiflash-columnar-hub/hub-runtime/src/run.rs (1)
1096-1119: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd an end-to-end GC lifecycle test.
The added test only validates TOML parsing; it does not prove the spawned loop removes expired IA metadata, evicts schema-cache entries, or exits promptly on shutdown. Add a deterministic integration test using a temporary data directory and a short interval.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs` around lines 1096 - 1119, Add a deterministic end-to-end test for spawn_background_gc_loop using a temporary data directory and short GC interval. Exercise expired IA metadata cleanup and schema-cache eviction, then signal shutdown and join the returned thread, asserting the loop exits promptly and both cleanup effects occur rather than only validating TOML parsing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs`:
- Around line 1096-1119: Add a deterministic end-to-end test for
spawn_background_gc_loop using a temporary data directory and short GC interval.
Exercise expired IA metadata cleanup and schema-cache eviction, then signal
shutdown and join the returned thread, asserting the loop exits promptly and
both cleanup effects occur rather than only validating TOML parsing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 693b2191-cd14-42c7-9df9-92a185f8b26c
📒 Files selected for processing (2)
contrib/tiflash-columnar-hub/hub-runtime/src/cloud_helper.rscontrib/tiflash-columnar-hub/hub-runtime/src/run.rs
🚧 Files skipped from review as they are similar to previous changes (1)
- contrib/tiflash-columnar-hub/hub-runtime/src/cloud_helper.rs
Signed-off-by: yongman <yming0221@gmail.com>
Signed-off-by: yongman <yming0221@gmail.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
contrib/tiflash-columnar-hub/hub-runtime/src/run.rs (1)
1707-1707: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winUpdate the stale Linux
ia.mem_capassertion.
ConfigFile::default()now setsconfig.ia.mem_captoPercent(10.0), but Line 1693 still expectsPercent(20.0), so the Linux test will fail.Proposed fix
- assert_eq!(config.ia.mem_cap, AbsoluteOrPercentSize::Percent(20.0)); + assert_eq!(config.ia.mem_cap, AbsoluteOrPercentSize::Percent(10.0));🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs` at line 1707, Update the Linux test’s stale ia.mem_cap assertion in the ConfigFile::default() validation to expect AbsoluteOrPercentSize::Percent(10.0), matching the current default; leave the existing ia_meta_cap assertion unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@contrib/tiflash-columnar-hub/hub-runtime/src/run.rs`:
- Line 1707: Update the Linux test’s stale ia.mem_cap assertion in the
ConfigFile::default() validation to expect AbsoluteOrPercentSize::Percent(10.0),
matching the current default; leave the existing ia_meta_cap assertion
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 359b9a0b-fa7a-48fa-9e22-a6cb64a917bd
⛔ Files ignored due to path filters (1)
contrib/tiflash-columnar-hub/Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
contrib/cloud-storage-enginecontrib/tiflash-columnar-hub/Cargo.tomlcontrib/tiflash-columnar-hub/hub-runtime/Cargo.tomlcontrib/tiflash-columnar-hub/hub-runtime/src/run.rs
Signed-off-by: yongman <yming0221@gmail.com>
[LGTM Timeline notifier]Timeline:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JaySon-Huang, JinheLin, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-nextgen-202603 |
|
@yongman: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: close #10995
ref https://github.com/tidbcloud/cloud-storage-engine/issues/5686
close https://github.com/tidbcloud/cloud-storage-engine/issues/5716
Problem Summary:
The disk or memory can be keep increasing in the long run with no background gc.
What is changed and how it works?
20%to10%.b49d94ae594914225390e3914f92025f1486d95bto fix the columnar file decryption with re-mapped file id during packed restoration.Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit