Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine docs: troubleshoot lock conflicts #9865

Merged
merged 6 commits into from Sep 30, 2022
Merged

Refine docs: troubleshoot lock conflicts #9865

merged 6 commits into from Sep 30, 2022

Conversation

qiancai
Copy link
Collaborator

@qiancai qiancai commented Aug 6, 2022

First-time contributors' checklist

What is changed, added or deleted? (Required)

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)
  • v6.2 (TiDB 6.2 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)

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

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

@qiancai qiancai added type/enhancement This issue/PR improves documentation usability or supplements document content. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. area/transaction Indicates that the Issue or PR belongs to the area of transaction. labels Aug 6, 2022
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 6, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • TomShawn

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 6, 2022
@qiancai qiancai added needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.0 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. labels Aug 6, 2022
Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

Rest LGTM

The pessimistic transaction adds an `Acquire Pessimistic Lock` phase before 2PC. This phase includes the following steps:

1. (Same as the optimistic transaction mode) Receive the `begin` request from the client, and the current timestamp is this transaction's start_ts.
2. When the TiDB server receives an `update` request from the client, the TiDB server initiates a pessimistic lock request to the TiKV server, and the lock is persisted to the TiKV server.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be talking about "writing new data", rather than talking about update statements specifically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MyonKeminta Please check if the following update is ok. Thanks.

image

pessimistic-transaction.md Outdated Show resolved Hide resolved
@@ -139,6 +139,20 @@ TiDB supports the following two isolation levels in the pessimistic transaction

- [Read Committed](/transaction-isolation-levels.md#read-committed-isolation-level). You can set this isolation level using the [`SET TRANSACTION`](/sql-statements/sql-statement-set-transaction.md) statement.

## Pessimistic transaction commit process

The commit phase of the pessimistic transaction mode and the optimistic transaction mode in TiDB has the same logic, and both commits are in the 2PC mode. The important adaptation of pessimistic transactions is DML execution.
Copy link
Contributor

@TomShawn TomShawn Sep 23, 2022

Choose a reason for hiding this comment

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

Suggested change
The commit phase of the pessimistic transaction mode and the optimistic transaction mode in TiDB has the same logic, and both commits are in the 2PC mode. The important adaptation of pessimistic transactions is DML execution.
The commits of the pessimistic transactions and the optimistic transactions in TiDB have the same logic. Both transactions adopt the two-phase commit (2PC) mode. The important adaptation of pessimistic transactions is DML execution.

Copy link
Contributor

Choose a reason for hiding this comment

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

Changing "the commit phase" to "commits" doesn't make sense to me. Here it's supposed to stands for the commit operation of a transaction. What we want to say here is 悲观事务和乐观事务的提交阶段逻辑相同.

pessimistic-transaction.md Outdated Show resolved Hide resolved
pessimistic-transaction.md Outdated Show resolved Hide resolved
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
pessimistic-transaction.md Outdated Show resolved Hide resolved
Copy link
Contributor

@TomShawn TomShawn 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 added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 23, 2022
Copy link
Contributor

@MyonKeminta MyonKeminta left a comment

Choose a reason for hiding this comment

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

Rest LGTM

pessimistic-transaction.md Outdated Show resolved Hide resolved
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
pessimistic-transaction.md Outdated Show resolved Hide resolved
@qiancai
Copy link
Collaborator Author

qiancai commented Sep 30, 2022

/remove-status LGT1
/status LGT2

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 30, 2022
@qiancai
Copy link
Collaborator Author

qiancai commented Sep 30, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 112ea3a

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Sep 30, 2022
@ti-chi-bot ti-chi-bot merged commit c9262e4 into pingcap:master Sep 30, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #10589.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #10590.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #10591.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #10592.

ti-chi-bot pushed a commit to ti-chi-bot/docs that referenced this pull request Sep 30, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #10593.

ti-chi-bot pushed a commit to ti-chi-bot/docs that referenced this pull request Sep 30, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/transaction Indicates that the Issue or PR belongs to the area of transaction. needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/from-docs-cn This PR is translated from a PR in pingcap/docs-cn. type/enhancement This issue/PR improves documentation usability or supplements document content.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants