Skip to content

cdc: adjust assertion when merge locks (#19047)#19052

Open
ti-chi-bot wants to merge 1 commit intotikv:release-9.0-beta.2from
ti-chi-bot:cherry-pick-19047-to-release-9.0-beta.2
Open

cdc: adjust assertion when merge locks (#19047)#19052
ti-chi-bot wants to merge 1 commit intotikv:release-9.0-beta.2from
ti-chi-bot:cherry-pick-19047-to-release-9.0-beta.2

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #19047

What is changed and how it works?

Issue Number: Close #19048

What's Changed:

fix potential panic which may happen when subscribe the region and meet rollback and prewrite entry

Similar to the #19025, but the region is subscribed after the rollback prewrite entry stored into the disk and before the prewrite the same key.


   → CDC calls push_lock for T2

The bug may occurs when:
1. T1 prewrites and commits key K (start_ts=100, commit_ts=110)
    → CF_WRITE[K@110] contains T1's committed write

2. T2 prewrites key K as a SECONDARY key (start_ts=111)
   → CF_LOCK[K] contains T2's lock

3. cdc subscribe the region
   → CF_LOCK[K@111] scanned out when doing incremental scan by the `scan_locks_from_storage`
   → CDC incremental scan finished and set to the resolver by the `finish_scan_locks`

4. T2 rolls back key K
   → Finds overlapped_write from T1 at commit_ts=110
   → Since K is NOT T2's primary: protected=false
   → make_rollback() returns None (no CF_WRITE entry!)
   → Only deletes from CF_LOCK
   → CDC ignores the DELETE operation

5. T3 prewrites key K
   → Triggers resolve_lock which removes T2's stale lock from CF_LOCK
   → No CDC notification

6. CDC processes T3's prewrite
   → Calls push_lock for T3
   → Finds T2's stale lock still in lock_tracker
   → Assertion fails: different start_ts

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Release note

fix potential panic which may happen when subscribe the region and meet rollback and prewrite entry

Signed-off-by: 3AceShowHand <jinl1037@hotmail.com>
@ti-chi-bot ti-chi-bot added dco-signoff: yes Indicates the PR's author has signed the dco. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/cherry-pick-for-release-9.0-beta.2 labels Oct 13, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 13, 2025

[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 yiwu-arbug 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
Copy link
Contributor

ti-chi-bot bot commented Oct 13, 2025

@ti-chi-bot: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-unit-test 7699e7b link true /test pull-unit-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-approved Cherry pick PR approved by release team. dco-signoff: yes Indicates the PR's author has signed the dco. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/cherry-pick-for-release-9.0-beta.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants