Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 16, 2025

Issue

The documentation in optimistic-transaction.md contained an outdated statement claiming "TiDB uses optimistic concurrency control by default", which has been incorrect since TiDB v3.0.8.

As documented in the v3.0.8 release notes, the default value of the tidb_txn_mode variable was changed from "" (optimistic) to "pessimistic" for newly created clusters starting from v3.0.8 (#14171).

Changes

Updated line 72 in optimistic-transaction.md to accurately reflect the current default behavior:

Before:
> TiDB uses optimistic concurrency control by default, whereas MySQL applies pessimistic concurrency control.

After:
> Starting from v3.0.8, TiDB uses the pessimistic transaction mode by default, the same as MySQL. This means that TiDB and MySQL add locks during the execution of write-type SQL statements, and its Repeatable Read isolation level allows for current reads, so commits generally do not encounter exceptions.

This change adds the temporal qualifier "Starting from v3.0.8" and updates the comparison with MySQL to indicate both databases now use pessimistic concurrency control by default.

Consistency

This update makes the documentation internally consistent:

  • The Note at line 15 of the same file already correctly states: "Starting from v3.0.8, TiDB uses the pessimistic transaction mode by default"
  • The pessimistic-transaction.md file documents the same default change
  • The troubleshoot-write-conflicts.md file also correctly uses the historical context: "Before TiDB v3.0.8..."

Fixes #21902

Original prompt

This section details on the original issue you should resolve

<issue_title>"TiDB uses optimistic concurrency control by default" does not look like valid since TiDB 3.0.8 tidb_txn_mode changed default value to pessimistic</issue_title>
<issue_description>File: /master/optimistic-transaction.md

Current description

says

TiDB uses optimistic concurrency control by default

Expected one

Since TiDB 3.0.8, TiDB uses pessimistic concurrency control by default. The document linked above should follow the default behavior.

https://docs.pingcap.com/tidb/stable/release-3.0.8/

Update the default value of the tidb_txn_mode variable from "" to "pessimistic" when a new cluster is created #14171</issue_description>

<agent_instructions>Update the optimistic-transaction.md file accordingly.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@yahonda "TiDB uses optimistic concurrency control by default whereas MySQL applies pessimistic concurrency control. " statement was added via https://github.com//pull/2088

Fixes #21902


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@ti-chi-bot ti-chi-bot bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 16, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 16, 2025

Hi @Copilot. 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.

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

pingcap-cla-assistant bot commented Oct 16, 2025

CLA assistant check
All committers have signed the CLA.

@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 16, 2025
@lilin90
Copy link
Member

lilin90 commented Oct 16, 2025

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 16, 2025
Co-authored-by: lilin90 <30922556+lilin90@users.noreply.github.com>
Copilot AI changed the title [WIP] Update optimistic transaction documentation to reflect concurrency control changes Fix outdated statement about TiDB's default transaction mode in optimistic-transaction.md Oct 16, 2025
Copilot AI requested a review from lilin90 October 16, 2025 03:47
Copilot finished work on behalf of lilin90 October 16, 2025 03:47
@hfxsd hfxsd removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 16, 2025
@hfxsd hfxsd requested review from MyonKeminta and yahonda October 16, 2025 06:41
@hfxsd hfxsd marked this pull request as ready for review October 16, 2025 06:42
@hfxsd hfxsd added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. and removed missing-translation-status This PR does not have translation status info. labels Oct 16, 2025
Copilot AI requested a review from lilin90 October 16, 2025 08:04
Copilot finished work on behalf of lilin90 October 16, 2025 08:04
Copy link
Member

@lilin90 lilin90 left a comment

Choose a reason for hiding this comment

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

/lgtm

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 16, 2025
@lilin90 lilin90 assigned hfxsd and unassigned lilin90 Oct 16, 2025
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 16, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 16, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-10-16 08:19:55.333007449 +0000 UTC m=+341501.410260019: ☑️ agreed by lilin90.
  • 2025-10-16 08:48:23.223500437 +0000 UTC m=+343209.300752987: ☑️ agreed by hfxsd.

@hfxsd
Copy link
Collaborator

hfxsd commented Oct 16, 2025

/approve

@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 16, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hfxsd

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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 Oct 16, 2025
@ti-chi-bot ti-chi-bot bot merged commit 0a8bfb3 into master Oct 16, 2025
10 checks passed
ti-chi-bot pushed a commit to ti-chi-bot/docs that referenced this pull request Oct 16, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #21924.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #21925.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. lgtm needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ok-to-test Indicates a PR is ready to be tested. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"TiDB uses optimistic concurrency control by default" does not look like valid since TiDB 3.0.8 tidb_txn_mode changed default value to pessimistic

4 participants