Skip to content

cloud: document TiDB X foreign key shared locks and lock upgrades - #23479

Open
wfxr wants to merge 3 commits into
release-8.5from
docs/tidb-x-fk-shared-lock-gate
Open

cloud: document TiDB X foreign key shared locks and lock upgrades#23479
wfxr wants to merge 3 commits into
release-8.5from
docs/tidb-x-fk-shared-lock-gate

Conversation

@wfxr

@wfxr wfxr commented Aug 10, 2026

Copy link
Copy Markdown
Member

What is changed, added or deleted? (Required)

Document the experimental controls and limitations for using shared locks during foreign key checks on TiDB X.

NOTE

This change applies only to TiDB X deployments used by TiDB Cloud Premium and Essential v2. It does not apply to TiDB Self-Managed (OP) or other classic TiDB deployments. The shared lock features are experimental and have not reached general availability (GA).

  • Explain that TiDB X requires [experimental].allow-enable-foreign-key-check-in-shared-lock to be enabled before SQL users can set tidb_foreign_key_check_in_shared_lock to ON.
  • Document that disabling the configuration prevents new SQL-level activation but does not override an ON value that has already been persisted or restored.
  • Document tidb_enable_shared_lock_upgrade for pessimistic transactions that update or delete a parent row after acquiring a shared lock on that row during a foreign key check.
  • Distinguish shared lock upgrade from tidb_enable_shared_lock_promotion and document shared lock limitations for aggressive locking mode, fair locking mode, one-phase commit, and Async Commit.

The foreign-key shared-lock gate changes were merged into TiDB master, while the shared lock upgrade change is tracked in pingcap/tidb#69559. This documentation PR targets release-8.5, which is the source branch for the current TiDB Cloud documentation. The documentation team can decide whether to apply the change to docs master during review.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions.

  • master (the latest development version)
  • v8.5 (TiDB 8.5 versions)
  • v8.4 (TiDB 8.4 versions)
  • v8.3 (TiDB 8.3 versions)
  • v8.2 (TiDB 8.2 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

Summary by CodeRabbit

  • Documentation
    • Added warnings that foreign-key checks with shared locks are experimental on TiDB X and not recommended for production.
    • Documented the configuration prerequisite for enabling this feature, including default behavior and handling of existing enabled values.
    • Clarified shared-lock behavior for pessimistic transactions, including limitations with one-phase and asynchronous commit.
    • Documented shared-lock promotion and the new option for upgrading an existing shared lock to an exclusive lock.

@ti-chi-bot

ti-chi-bot Bot commented Aug 10, 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 added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The documentation clarifies shared-lock promotion and upgrade behavior. It adds the experimental TiDB X configuration for shared-lock foreign key checks, including prerequisites, persisted-value behavior, transaction limitations, and warnings.

Changes

Foreign Key Shared-Lock Documentation

Layer / File(s) Summary
Shared-lock variable contract
system-variables.md
Clarifies that shared-lock promotion acquires an exclusive lock directly. Documents shared-lock upgrade behavior and its locking-mode limitations.
Foreign key configuration and guidance
tidb-configuration-file.md, system-variables.md, foreign-key.md
Documents the experimental configuration, its default-disabled state, persisted or restored values, foreign key locking prerequisites, transaction limitations, and production-use warning.

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

Merge Risk: 🔵 Low · up to bc4ce

The documentation currently does not state that shared-lock upgrade is limited to TiDB X and unsupported in aggressive or fair locking modes, which could mislead users configuring foreign-key checks. The PR is mergeable with explicit owner follow-up to add those constraints.

Suggested reviewers: qiancai, ti-chi-bot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the main change: documenting TiDB X foreign-key shared locks and lock upgrades.
Description check ✅ Passed The description is mostly complete and explains the scope, behavior, limitations, related PRs, AI involvement, and branch-specific follow-up. The v8.5 checkbox is not selected even though the descript…
Full details: Docstring Coverage

Explanation

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 files. (3 skipped: 3 unsupported.)

Full details: Description check

Explanation

The description is mostly complete and explains the scope, behavior, limitations, related PRs, AI involvement, and branch-specific follow-up. The v8.5 checkbox is not selected even though the description states that the PR targets release-8.5.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/tidb-x-fk-shared-lock-gate

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.

@wfxr

wfxr commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

/label version-specific-changes-required

@ti-chi-bot ti-chi-bot Bot added the missing-translation-status This PR does not have translation status info. label Aug 10, 2026
@ti-chi-bot

ti-chi-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

@wfxr: The label(s) version-specific-changes-required cannot be applied. These labels are supported: 2024-tidb-docs-dash, contribution, first-time-contributor, for-future-release, good first issue, hacktoberfest-accepted, Hacktoberfest, help wanted, needs-cherry-pick-master, needs-cherry-pick-release-7.5, needs-cherry-pick-release-8.1, needs-cherry-pick-release-8.5, needs-cherry-pick-release-9.0-beta.2, needs-cherry-pick-release-cloud, needs-cherry-pick-release-8.2, needs-cherry-pick-release-8.3, needs-cherry-pick-release-8.4, question, requires-followup, requires-version-specific-changes, special-week, website.

Details

In response to this:

/label version-specific-changes-required

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 ti-community-infra/tichi repository.

@pingcap-cla-assistant

pingcap-cla-assistant Bot commented Aug 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 10, 2026
@wfxr

wfxr commented Aug 10, 2026

Copy link
Copy Markdown
Member Author

/label requires-version-specific-changes

@ti-chi-bot ti-chi-bot Bot added the requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. label Aug 10, 2026
@wfxr
wfxr marked this pull request as ready for review August 10, 2026 07:06
@ti-chi-bot ti-chi-bot Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 10, 2026
@lilin90
lilin90 requested a review from qiancai August 10, 2026 07:53
@qiancai qiancai self-assigned this Aug 11, 2026
@wfxr

wfxr commented Aug 11, 2026

Copy link
Copy Markdown
Member Author

/hold

@ti-chi-bot ti-chi-bot Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 11, 2026
Add the experimental TiDB X configuration and clarify the system variable prerequisite. Document how persisted or restored ON values behave across upgrades.
@wfxr
wfxr force-pushed the docs/tidb-x-fk-shared-lock-gate branch from e9b2967 to f278fd0 Compare September 2, 2026 00:47
@ti-chi-bot

ti-chi-bot Bot commented Sep 2, 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 ask for approval from qiancai. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 2, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: e964db16-00b9-49ef-909a-34fb22479bae

📥 Commits

Reviewing files that changed from the base of the PR and between f278fd0 and bc4ce17.

📒 Files selected for processing (3)
  • foreign-key.md
  • system-variables.md
  • tidb-configuration-file.md

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread foreign-key.md
@wfxr wfxr changed the title cloud: document the TiDB X foreign key shared lock gate cloud: document TiDB X foreign key shared locks and lock upgrades Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. missing-translation-status This PR does not have translation status info. requires-version-specific-changes After cherry-picked, the cherry-picked PR requires further changes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants