sql-statements: say that optimistic constraint checks are deferred until the transaction is committed (#24027) - #24064
Conversation
…til the transaction is committed Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingcap/docs/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe MySQL compatibility note now states that, with Optimistic Locking enabled, ChangesMySQL compatibility note
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Other Merge Risk: ⚪ Minimal · up to The note clarifies when checks occur while retaining the COMMIT failure and setting exception; no material merge risk is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 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 |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qiancai 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 |
This is an automated cherry-pick of #24027
What is changed, added, or deleted? (Required)
In
sql-statements/sql-statement-commit.md, the MySQL compatibility section says that with optimistic locking,UNIQUEandPRIMARY KEYconstraint checks "are deferred until statement commit". The checks are deferred until the transaction commits, which is why theCOMMITstatement can fail. The same behavior is described that way elsewhere:constraints.md: "the unique check was deferred until the transaction is committed".transaction-overview.md: "These checks are instead performed on transactionCOMMIT".This PR changes "until statement commit" to "until the transaction is committed". It was flagged by CodeRabbit on the Japanese translation PR #24017, which inherited it from EN.
Which TiDB version(s) do your changes apply to? (Required)
What is the related PR or file link(s)?
AI agent involvement
Do your changes match any of the following descriptions?
🤖 Generated with Claude Code
Summary by CodeRabbit
UNIQUEandPRIMARY KEYconstraint checks occur at transaction commit and may causeCOMMITto fail. The note also describes howtidb_constraint_check_in_place=ONaffects this behavior.