Skip to content

sql-statements: say that optimistic constraint checks are deferred until the transaction is committed (#24027) - #24064

Merged
ti-chi-bot[bot] merged 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-24027-to-release-8.5
Sep 30, 2026
Merged

ti-chi-bot[bot] merged 1 commit into
pingcap:release-8.5from
ti-chi-bot:cherry-pick-24027-to-release-8.5

Conversation

@ti-chi-bot

@ti-chi-bot ti-chi-bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

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, UNIQUE and PRIMARY KEY constraint checks "are deferred until statement commit". The checks are deferred until the transaction commits, which is why the COMMIT statement 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 transaction COMMIT".

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)

  • master (the latest development version)
  • v9.0 (TiDB 9.0 versions)
  • v8.5 (TiDB 8.5 versions)
  • v8.1 (TiDB 8.1 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 versions)

What is the related PR or file link(s)?

AI agent involvement

  • The changes in this PR were primarily made by an AI agent on behalf of the PR author.

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Clarified that, with Optimistic Locking enabled, MySQL UNIQUE and PRIMARY KEY constraint checks occur at transaction commit and may cause COMMIT to fail. The note also describes how tidb_constraint_check_in_place=ON affects this behavior.

…til the transaction is committed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ti-chi-bot ti-chi-bot added lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR. labels Sep 30, 2026
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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 configuration

Configuration used: Repository: pingcap/docs/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e9cd76d2-0067-4f26-b650-8c175c38586b

📥 Commits

Reviewing files that changed from the base of the PR and between b3ad43c and ab50afb.

📒 Files selected for processing (1)
  • sql-statements/sql-statement-commit.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

The MySQL compatibility note now states that, with Optimistic Locking enabled, UNIQUE and PRIMARY KEY checks are deferred until transaction commit. It retains the possible COMMIT failure and the tidb_constraint_check_in_place=ON setting.

Changes

MySQL compatibility note

Layer / File(s) Summary
Constraint check timing
sql-statements/sql-statement-commit.md
The note changes the deferral point for UNIQUE and PRIMARY KEY checks from statement commit to transaction commit. It retains the possible COMMIT failure and the tidb_constraint_check_in_place=ON setting.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~2 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to ab50a

The note clarifies when checks occur while retaining the COMMIT failure and setting exception; no material merge risk is evident.

Architecture Summary

Architecture risk: 🔵 Low · up to ab50a

The change affects 1 system.

Changed systems: sql-statements

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — sql-statements (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in sql-statements/sql-statement-commit.md: The compatibility note changes the stated deferral point for UNIQUE and PRIMARY KEY checks from statement commit to transaction commit; the possible COMMIT failure and the tidb_constraint_check_in_place=ON setting remain unchanged.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the documentation file and the main change: clarifying that optimistic constraint checks are deferred until transaction commit.
Description check ✅ Passed The description covers the required change, affected versions, reference PR, AI involvement, and change-category checklist. It also explains the reason for the wording change and its relation to the a…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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.

@qiancai

qiancai commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

/approve

@ti-chi-bot

ti-chi-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown

[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

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 approved label Sep 30, 2026
@ti-chi-bot
ti-chi-bot Bot merged commit 0d68038 into pingcap:release-8.5 Sep 30, 2026
12 checks passed
@ti-chi-bot
ti-chi-bot Bot deleted the cherry-pick-24027-to-release-8.5 branch September 30, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-1-more-lgtm Indicates a PR needs 1 more LGTM. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. type/cherry-pick-for-release-8.5 This PR is cherry-picked to release-8.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants