client: recognize v2 keyspace-level GC - #11100
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Signed-off-by: Ping Yu <yuping@pingcap.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe client now prioritizes ChangesCES keyspace-level GC detection
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #11100 +/- ##
==========================================
+ Coverage 79.35% 79.41% +0.06%
==========================================
Files 542 542
Lines 76993 77006 +13
==========================================
+ Hits 61097 61156 +59
+ Misses 11594 11557 -37
+ Partials 4302 4293 -9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
/retest |
| // IsCESKeyspaceLevelGC reports whether a keyspace uses the CES keyspace-level GC metadata format. | ||
| func IsCESKeyspaceLevelGC(keyspaceMeta *keyspacepb.KeyspaceMeta) bool { |
There was a problem hiding this comment.
| // IsCESKeyspaceLevelGC reports whether a keyspace uses the CES keyspace-level GC metadata format. | |
| func IsCESKeyspaceLevelGC(keyspaceMeta *keyspacepb.KeyspaceMeta) bool { | |
| // IsCSEKeyspaceLevelGC reports whether a keyspace uses the CSE keyspace-level GC metadata format. | |
| func IsCSEKeyspaceLevelGC(keyspaceMeta *keyspacepb.KeyspaceMeta) bool { |
| re.False(IsKeyspaceUsingKeyspaceLevelGC(meta)) | ||
| } | ||
|
|
||
| func TestIsCESKeyspaceLevelGC(t *testing.T) { |
| } | ||
|
|
||
| // IsCSEKeyspaceLevelGC reports whether a keyspace uses the CSE keyspace-level GC metadata format. | ||
| func IsCSEKeyspaceLevelGC(keyspaceMeta *keyspacepb.KeyspaceMeta) bool { |
There was a problem hiding this comment.
Can we extend the existing IsKeyspaceUsingKeyspaceLevelGC? PD doesn't know what CSE is.
Apply review feedback by extending the existing keyspace-level GC predicate instead of exposing a CSE-specific API. Signed-off-by: Ping Yu <yuping@pingcap.com>
| if keyspaceMeta == nil || keyspaceMeta.Config == nil { | ||
| return false | ||
| } | ||
| return keyspaceMeta.Config[KeyspaceConfigGCManagementType] == KeyspaceConfigGCManagementTypeKeyspaceLevel || |
|
/retest |
1 similar comment
|
/retest |
|
/retest |
[LGTM Timeline notifier]Timeline:
|
|
/retest |
| if keyspaceMeta == nil || keyspaceMeta.Config == nil { | ||
| return false | ||
| } | ||
| return keyspaceMeta.Config[KeyspaceConfigGCManagementType] == KeyspaceConfigGCManagementTypeKeyspaceLevel || |
There was a problem hiding this comment.
gpt-5.6-sol:
This condition treats safe_point_version == "v2" as authoritative even when gc_management_type is explicitly set. Because keyspace config updates use PATCH semantics, an upgraded keyspace may retain the legacy field:
Config: map[string]string{
"gc_management_type": "unified",
"safe_point_version": "v2",
}The current || expression returns true for this configuration, causing callers to use the keyspace-level GC/safepoint path even though the canonical field selects unified.
Consider checking gc_management_type first and falling back to safe_point_version only when the canonical field is absent. Please also add a regression test for this conflicting-fields case.
Signed-off-by: Ping Yu <yuping@pingcap.com>
…v1-gc Signed-off-by: Ping Yu <yuping@pingcap.com>
|
/retest |
|
@wfxr: adding LGTM is restricted to approvers and reviewers in OWNERS files. 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 kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bufferflies, wfxr, ystaticy 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 |
|
/retest |
1 similar comment
|
/retest |
What problem does this PR solve?
Issue Number: close #11108
Downstream issue: pingcap/ticdc#5785
TiDB Cloud Essential v1 keyspaces use
safe_point_version=v2to indicate keyspace-level GC. Existing downstream code already relies onIsKeyspaceUsingKeyspaceLevelGC, but that predicate only recognizesgc_management_type=keyspace_level.What is changed and how does it work?
Extend
IsKeyspaceUsingKeyspaceLevelGCto recognize either native keyspace-level GC metadata or the exactsafe_point_version=v2setting. This keeps PD terminology deployment-agnostic and lets existing client-go and TiDB callers select the correct keyspace-scoped metadata without component-specific helpers.Check List
Tests
make basic-testinclient/make gotest GOTEST_ARGS='./... -run TestIsKeyspaceUsingKeyspaceLevelGC -count=1'inclient/safe_point_version=v2returns true, and malformedV2returns falseRelated changes
Release note
Summary by CodeRabbit