Skip to content

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #21921

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 added 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 ok-to-test Indicates a PR is ready to be tested. 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 Oct 16, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @ti-chi-bot, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical documentation inaccuracy in optimistic-transaction.md. It updates a statement regarding TiDB's default transaction mode to reflect the change introduced in v3.0.8, where the default shifted from optimistic to pessimistic concurrency control. This ensures that users receive current and consistent information about TiDB's behavior, improving the overall accuracy and reliability of the documentation.

Highlights

  • Documentation Correction: Corrected an outdated statement in optimistic-transaction.md that incorrectly claimed TiDB uses optimistic concurrency control by default.
  • Default Transaction Mode: Updated the documentation to accurately state that TiDB has used pessimistic transaction mode by default since v3.0.8, aligning with MySQL's default behavior.
  • Documentation Consistency: Ensured consistency across related documentation files regarding TiDB's default transaction mode, referencing existing correct statements in other sections and files.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates an outdated statement about TiDB's default transaction mode in optimistic-transaction.md. My review focuses on minor grammatical corrections to improve clarity and accuracy, as per the repository's style guide for automated pull requests. I've suggested a small change to the paragraph on line 71 to fix pronoun agreement and tense.

@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 4d38b96 into pingcap:release-8.5 Oct 16, 2025
9 checks passed
@ti-chi-bot ti-chi-bot bot deleted the cherry-pick-21921-to-release-8.5 branch October 16, 2025 09:23
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 ok-to-test Indicates a PR is ready to be tested. 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.

2 participants