columnar: gc ia meta & schema files in cloud_helper#10988
Conversation
Signed-off-by: yongman <yming0221@gmail.com>
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 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 CloudHelper
participant IAMetaFiles
EngineStoreLifecycle->>BackgroundGCLoop: start when local_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 | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
Signed-off-by: yongman <yming0221@gmail.com>
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
|
@yongman: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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 kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What problem does this PR solve?
Issue Number: close #10995
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?
Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit
New Features
Bug Fixes
Tests