Skip to content

Private/issue 10444 anti dep write skew#68445

Draft
ljluestc wants to merge 4 commits into
pingcap:masterfrom
ljluestc:private/issue-10444-anti-dep-write-skew
Draft

Private/issue 10444 anti dep write skew#68445
ljluestc wants to merge 4 commits into
pingcap:masterfrom
ljluestc:private/issue-10444-anti-dep-write-skew

Conversation

@ljluestc
Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: ref #10444

Problem Summary:

#10444 报告了在 SELECT ... FOR UPDATE 场景下,针对不存在键可能出现反依赖环(G2)与写偏斜(A5B)异常。
本 PR 的目标是补齐并发回归测试,持续验证悲观事务 + RR 下的锁行为,避免该类问题回归。

What changed and how does it work?

本次为测试增强,不涉及生产逻辑改动,主要包括:

  1. pkg/executor/test/writetest/write_test.go
  • 新增 TestPessimisticForUpdateLockNonExistentKey
  • 验证 point-get FOR UPDATE 在不存在键上仍形成正确阻塞与串行化
  1. tests/realtikvtest/txntest/isolation_test.go

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

本地验证命令与结果:

  1. executor 快速回归
go test -run TestPessimisticForUpdateLockNonExistentKey -tags=intest,deadlock ./pkg/executor/test/writetest

结果:ok github.com/pingcap/tidb/pkg/executor/test/writetest

  1. RealTiKV 回归
go test -run 'TestG2AntiDependencyCycleForUpdate|TestA5BWriteSkewForUpdateNonExistent' -tags=intest,deadlock ./tests/realtikvtest/txntest/...

结果:ok github.com/pingcap/tidb/tests/realtikvtest/txntest

补充说明:

  • 当前环境中 make bazel_prepare 因 Bazel native thread / resource limit OOM 失败,属于环境资源限制,并非本次用例逻辑失败。

Side effects

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

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

ljluestc added 3 commits May 17, 2026 00:07
…existent keys

Add tests verifying that pessimistic RR mode correctly acquires locks on
non-existent point-get keys via SELECT ... FOR UPDATE, preventing the
anti-dependency cycles (G2) and write skew (A5B) reported in pingcap#10444.

Unit test (mock store):
- TestPessimisticForUpdateLockNonExistentKey in write_test.go

RealTiKV tests:
- TestG2AntiDependencyCycleForUpdate
- TestA5BWriteSkewForUpdateNonExistent

ref pingcap#10444
Add comprehensive Chinese language PR description documenting the
anti-dependency cycle and write skew regression tests for SELECT ... FOR UPDATE
on non-existent keys, including test scenarios, verification results,
risk assessment, and rollback procedures.

Closes pingcap#10444
…ssion tests

Add comprehensive PR description following TiDB official template format
with complete problem statement, solution details, testing instructions,
verification results, checklist completion, and release notes.

Closes pingcap#10444
@ti-chi-bot ti-chi-bot Bot added do-not-merge/invalid-title release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 17, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 20ddc9e8-043f-464a-ab2d-8264fded34a2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 17, 2026

[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 qiuyesuifeng 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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. contribution This PR is from a community contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels May 17, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 17, 2026

Hi @ljluestc. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@pingcap-cla-assistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@tiprow
Copy link
Copy Markdown

tiprow Bot commented May 17, 2026

Hi @ljluestc. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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
Copy link
Copy Markdown

ti-chi-bot Bot commented May 17, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/invalid-title label, please follow title format, for example pkg [, pkg2, pkg3]: what is changed or *: what is changed.

📖 For more info, you can check the "Contribute Code" section in the development guide.

@ti-chi-bot ti-chi-bot Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. do-not-merge/invalid-title do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. release-note-none Denotes a PR that doesn't merit a release note. 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.

1 participant