Skip to content

txnutil: scan past shared readers during progress repair - #6971

Draft
ekexium wants to merge 1 commit into
pingcap:masterfrom
ekexium:sfs/ticdc-shared-lock-checkpoint
Draft

ekexium wants to merge 1 commit into
pingcap:masterfrom
ekexium:sfs/ticdc-shared-lock-checkpoint

Conversation

@ekexium

@ekexium ekexium commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: close #6970

Related: pingcap/tidb#73623

When TiKV scans locks for checkpoint progress repair, shared-lock wrappers are expanded into individual holders that count toward scanLockLimit. If a single key holds enough live shared readers to fill a page, TiCDC previously fed those lock-only shared holders to the resolver and stopped scanning the remainder of the region once a live holder returned a non-zero TTL—stranding later expired data locks and stalling checkpoint advancement.

What is changed and how it works?

  • Filter out lock-only entries before resolving: resolveScanLockInfos now skips Op_SharedLock, Op_Lock, and Op_PessimisticLock entries and passes only data locks to the resolver, since pure lock metadata cannot block resolved-ts or checkpoint progress.
  • Advance pagination past full shared-lock pages: nextScanLockKey counts individual shared holders (max(1, len(info.GetSharedLockInfos()))) against scanLockLimit and, when a page is full, advances the cursor to lastKey + 0x00 so subsequent scans move past live shared-lock keys to reach later data locks in the same region.

Planned for cherry-pick to release-8.5.

Check List

Tests

  • Unit test

Verified with go test -count=1 ./logservice/txnutil (covers skipping shared-lock pages and continuing past attempted data locks).

Questions

Will it cause performance regression or break compatibility?

No compatibility impact (wire format and configuration are unchanged). Skipping lock-only metadata avoids unnecessary resolver RPCs for shared readers; regions with dense shared readers may issue extra ScanLock pages to reach trailing data locks.

Do you need to update user documentation, design documentation or monitoring documentation?

No. This is an internal fix to lock-resolution pagination during checkpoint progress repair.

Release note

Fix an issue where concurrent shared-lock readers could cause TiCDC progress repair to skip subsequent data locks and delay checkpoint advancement.

Count shared members for pagination and skip metadata-only locks when advancing resolved-ts. Resume after the attempted physical key so a page of live readers cannot hide a later expired data lock.

Signed-off-by: Ziqian Qin <eke@fastmail.com>
@ti-chi-bot

ti-chi-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

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 commented Nov 23, 2026

Copy link
Copy Markdown

[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 flowbehappy 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 do-not-merge/needs-triage-completed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

txnutil: skip lock-only shared-lock wrappers during checkpoint repair

1 participant