Skip to content

tools: add a CLI for keyspace GC barriers - #11223

Draft
wfxr wants to merge 1 commit into
tikv:release-nextgen-20251011from
wfxr:tools/gc-barrier-nextgen
Draft

tools: add a CLI for keyspace GC barriers#11223
wfxr wants to merge 1 commit into
tikv:release-nextgen-20251011from
wfxr:tools/gc-barrier-nextgen

Conversation

@wfxr

@wfxr wfxr commented Sep 10, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

A stale TiCDC GC barrier can prevent obsolete data from being reclaimed. Operators need a way to inspect, update, and delete individual barriers so they can control how much history becomes eligible for GC.

This is a review-only draft and is not intended to be merged. The implementation is based on v8.5.4-nextgen.202510.7 and uses that version's existing PD gRPC APIs.

Issue Number: None (review-only draft).

What is changed and how does it work?

Add a standalone pd-gc-barrier CLI with show, set, and delete commands for explicitly selected keyspaces. Set creates or updates both the barrier timestamp and TTL, including non-expiring barriers.

Accept decimal TSO and timezone-bearing RFC3339 input, validate the requested GC scope, and preserve full TSO precision in JSON output. Support TLS credentials, command timeouts, and clear error reporting. Include unit tests, local NextGen PD integration coverage, and an English usage reference.

Check List

Tests

  • Unit tests and local PD integration test: go test -tags nextgen,without_dashboard,integration ./pd-gc-barrier -count=1 -timeout=5m from tools/, with failpoints enabled and then disabled.
  • Static checks: targeted golangci-lint passed for the tool and its tests.
  • Manual executable checks: help, invalid keyspace IDs, TSO/TTL validation, TLS argument validation, connection timeout, nonzero error exit status, and stderr/stdout separation.

Release note

None.

Provide show, set, and delete commands for keyspace GC barriers so
operators can inspect retention constraints and update timestamps and
lifetimes without changing applications.

Require an explicit keyspace and TTL, accept decimal TSO and RFC3339
input, and preserve TSO precision in JSON output. Include CLI tests,
NextGen PD integration coverage, and usage documentation.

Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot Bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/cherry-pick-not-approved labels Sep 10, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

This cherry pick PR is for a release branch and has not yet been approved by triage owners.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick:

  1. It must be LGTMed and approved by the reviewers firstly.
  2. For pull requests to TiDB-x branches, it must have no failed tests.
  3. AFTER it has lgtm and approved labels, please wait for the cherry-pick merging approval from triage owners.
Details

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.

@ti-chi-bot ti-chi-bot Bot added the dco-signoff: yes Indicates the PR's author has signed the dco. label Sep 10, 2026
@ti-chi-bot

ti-chi-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lhy1024 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 10, 2026
@wfxr

wfxr commented Sep 10, 2026

Copy link
Copy Markdown
Member Author

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2026
@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.39752% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.66%. Comparing base (14fe15c) to head (e7eabf7).
⚠️ Report is 9 commits behind head on release-nextgen-20251011.

Additional details and impacted files
@@                     Coverage Diff                      @@
##           release-nextgen-20251011   #11223      +/-   ##
============================================================
- Coverage                     78.73%   78.66%   -0.07%     
============================================================
  Files                           491      492       +1     
  Lines                         66124    66498     +374     
============================================================
+ Hits                          52060    52313     +253     
- Misses                        10308    10425     +117     
- Partials                       3756     3760       +4     
Flag Coverage Δ
unittests 78.66% <76.39%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the dco. do-not-merge/cherry-pick-not-approved do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant