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

txn: update the document about read-consistency read check ts variable #8617

Merged
merged 23 commits into from
Mar 24, 2022

Conversation

cfzjywxk
Copy link
Contributor

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 (in Chinese).

  • master (the latest development version)
  • v6.0 (TiDB 6.0 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)
  • v4.0 (TiDB 4.0 versions)
  • v3.1 (TiDB 3.1 versions)
  • v3.0 (TiDB 3.0 versions)
  • v2.1 (TiDB 2.1 versions)

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

  • This PR is translated from:
  • Other reference 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

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 10, 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 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 Mar 10, 2022
@TomShawn TomShawn added the v6.0 This PR/issue applies to TiDB v6.0. label Mar 10, 2022
@TomShawn
Copy link
Contributor

@cfzjywxk Could you please invite a technical review? Thanks~

@TomShawn TomShawn requested review from en-jin19 and removed request for TomShawn March 10, 2022 10:56
@TomShawn TomShawn added area/transaction Indicates that the Issue or PR belongs to the area of transaction. translation/doing This PR’s assignee is translating this PR. labels Mar 10, 2022
@ti-chi-bot ti-chi-bot removed the missing-translation-status This PR does not have translation status info. label Mar 10, 2022
@ti-chi-bot ti-chi-bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 14, 2022
@cfzjywxk cfzjywxk requested a review from you06 March 15, 2022 09:53
@en-jin19 en-jin19 added the type/compatibility-or-feature-change This PR involves compatibility changes or feature behavior changes. label Mar 15, 2022
Comment on lines 1332 to 1333
- 悲观事务中当 `READ-COMMITTED` 隔离级别启用之后,每个事务中 `SELECT` 语句会尝试获取一个新的 `timestamp` 用于数据读取。当开启此变量之后,`SELECT` 语句会尝试使用前一个有效的 `timestamp` 进行数据读取,初始值为事务的 `start_ts`。如果整个读取过程没有遇到更新版本,则返回结果给客户端且 `SELECT` 语句执行成功。当读到过程遇到更新的版本时,如果当前 `TiDB` 尚未向客户端回复数据,则尝试重新获取一个新的 `timestamp` 重试此语句。如果已经回复过客户端数据,则 `TiDB` 会向客户端报错。回复客户端数据量受 `tidb_init_chunk_size` 和 `tidb_max_chunk_size` 控制。在使用 `READ-COMMITTED` 隔离级别且单个事务中 `SELECT` 语句较多,读写冲突较少的场景,可通过开启此变量用以避免获取全局 `timestamp` 带来的延迟和开销。

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest you only mention that it's an optimization for RC transactions that's suitable for read-heavy workloads, and put these implementation details in a supplementary information block (so that users don't have to understand it). Like this:

> **说明:**
>
> * 在这里解释取 ts 之类的内部原理

I think a user may not understand what it means by retrieving a timestamp or finding a newer version. It's too complex for user.

system-variables.md Outdated Show resolved Hide resolved
- 适用于悲观事务 `READ-COMMITTED` 隔离级别下,读写冲突较少场景,优化事务内读语句延迟。如果读写冲突较为严重,开启此功能会增加额外开销和延迟,造成性能回退。

> **说明:**
> 悲观事务中当 `READ-COMMITTED` 隔离级别启用之后,每个事务中 `SELECT` 语句会尝试获取一个新的 timestamp 用于数据读取。当开启此变量之后,`SELECT` 语句会尝试使用前一个有效的 timestamp 进行数据读取,初始值为事务的 `start_ts`。如果整个读取过程没有遇到更新版本,则返回结果给客户端且 `SELECT` 语句执行成功。当读的过程中遇到更新的版本时,如果当前 TiDB 尚未向客户端回复数据,则尝试重新获取一个新的 timestamp 重试此语句。如果已经向客户端返回部分数据,则 TiDB 会向客户端报错。每次向客户端回复的数据量受 `tidb_init_chunk_size` 和 `tidb_max_chunk_size` 控制。在使用 `READ-COMMITTED` 隔离级别且单个事务中 `SELECT` 语句较多,读写冲突较少的场景,可通过开启此变量用以避免获取全局 timestamp 带来的延迟和开销。
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的【整个读取过程没有遇到更新版本】中的【更新版本】是指更新的数据版本吗?

system-variables.md Outdated Show resolved Hide resolved
@TomShawn
Copy link
Contributor

tidb_rc_read_check_ts 较多说明以及使用限制放在变量文档里,有点塞不下的感觉,而且也不易查找。能否考虑将特性说明放在 https://docs.pingcap.com/zh/tidb/dev/transaction-isolation-levels 这里或是哪篇文档里,而变量文档只需简单介绍变量即可?

cfzjywxk and others added 5 commits March 24, 2022 14:39
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
system-variables.md Outdated Show resolved Hide resolved
transaction-isolation-levels.md Outdated Show resolved Hide resolved
cfzjywxk and others added 3 commits March 24, 2022 15:10
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
Co-authored-by: TomShawn <41534398+TomShawn@users.noreply.github.com>
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 Mar 24, 2022
@TomShawn
Copy link
Contributor

/remove-status LGT1
/status LGT3

@ti-chi-bot ti-chi-bot added status/LGT3 The PR has already had 3 LGTM. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 24, 2022
system-variables.md Outdated Show resolved Hide resolved
@TomShawn TomShawn added translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. and removed translation/doing This PR’s assignee is translating this PR. labels Mar 24, 2022
@TomShawn
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 5d35b6c

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 24, 2022
@ti-chi-bot ti-chi-bot merged commit 934ae96 into master Mar 24, 2022
@ran-huang ran-huang deleted the cfzjywxk-patch-2-1 branch March 25, 2022 11:00
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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT3 The PR has already had 3 LGTM. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. type/compatibility-or-feature-change This PR involves compatibility changes or feature behavior changes. v6.0 This PR/issue applies to TiDB v6.0.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants