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

sys var: add tidb_enable_shared_lock_promotion related doc change #18229

Merged
merged 23 commits into from
Aug 15, 2024

Conversation

cfzjywxk
Copy link
Contributor

@cfzjywxk cfzjywxk commented Aug 2, 2024

First-time contributors' checklist

What is changed, added or deleted? (Required)

Referenced tidb issue pingcap/tidb#55022, the document for supporting upgrading for share lock statement to for update statement.

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)
  • v8.3 (TiDB 8.3 versions)
  • v8.2 (TiDB 8.2 versions)
  • v8.1 (TiDB 8.1 versions)
  • v8.0 (TiDB 8.0 versions)
  • v7.5 (TiDB 7.5 versions)
  • v7.1 (TiDB 7.1 versions)
  • v6.5 (TiDB 6.5 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)

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

Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@ti-chi-bot ti-chi-bot bot added missing-translation-status This PR does not have translation status info. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 2, 2024
Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@hfxsd hfxsd added the v8.3 label Aug 2, 2024
@hfxsd hfxsd self-assigned this Aug 2, 2024
@hfxsd hfxsd added translation/doing This PR’s assignee is translating this PR. type/compatibility-or-feature-change This PR involves compatibility changes or feature behavior changes. and removed missing-translation-status This PR does not have translation status info. labels Aug 2, 2024
- 是否持久化到集群:是
- 类型:布尔型
- 默认值:`OFF`
- 该变量用于控制是否启用共享锁升级为排他锁的功能。当该变量值为 `ON` 时,TiDB 会尝试将共享锁升级为排他锁,以减少死锁的概率。该变量默认值为 `OFF`,表示不启用共享锁升级为排他锁的功能。注意该变量不可和 [`tidb_enable_noop_functions`](#tidb_enable_noop_functions-span-classversion-mark从-v40-版本开始引入span) 同时开启。
Copy link
Contributor

Choose a reason for hiding this comment

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

@cfzjywxk 如果同时开启 enable noop function,是不是shared lock 应该以这个变量为准?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@joey-yez 目前如果开了 enable noop function 再开 shared lock upgrade,会报错。在设置 variable 那里有检查

Copy link
Contributor Author

Choose a reason for hiding this comment

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

描述已修改

hfxsd and others added 2 commits August 2, 2024 11:00
Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@cfzjywxk cfzjywxk force-pushed the upgrade_shared_lock branch from 2da0067 to 5c9e67e Compare August 2, 2024 05:01
Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
@cfzjywxk cfzjywxk requested a review from joey-yez August 2, 2024 05:04
@hfxsd hfxsd changed the title sys var: add tidb_enable_shared_lock_upgrade related doc change sys var: add tidb_enable_shared_lock_upgrade related doc change Aug 2, 2024
cfzjywxk and others added 2 commits August 2, 2024 14:53
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
@hfxsd hfxsd removed the translation/doing This PR’s assignee is translating this PR. label Aug 2, 2024
使用这个语句执行的时候,效果和没有加锁是一样的,不会阻塞其他事务的读写。
TiDB 默认不支持 `SELECT LOCK IN SHARE MODE`。

从 v8.3.0 版本开始,TiDB 支持使用 [`tidb_enable_shared_lock_upgrade`](/system-variables.md#tidb_enable_shared_lock_upgrade-span-classversion-mark从-v830-版本开始引入span) 系统变量开启 `SELECT LOCK IN SHARE MODE` 语句的功能。开启后,`SELECT LOCK IN SHARE MODE` 语句会升级为 `SELECT FOR UPDATE` 语句,对数据行加悲观锁。
Copy link
Contributor

@MyonKeminta MyonKeminta Aug 6, 2024

Choose a reason for hiding this comment

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

有点担心表述可能造成误解,是不是最好直接说 SELECT LOCK IN SHARE MODE 会进行等同于 SELECT FOR UPDATE 的行为,而不是先说启用 SELECT LOCK IN SHARE MODE 的功能、后面再补充解释比较好?另外后面的“升级”这个表述感觉对用户来说可能也不是很好理解

cfzjywxk and others added 2 commits August 6, 2024 12:54
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 6, 2024

@joey-yez PTAL again

@cfzjywxk cfzjywxk changed the title sys var: add tidb_enable_shared_lock_upgrade related doc change sys var: add tidb_enable_shared_lock_promotion related doc change Aug 8, 2024
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.

Rest LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 15, 2024
Copy link

ti-chi-bot bot commented Aug 15, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-06 01:43:58.045129708 +0000 UTC m=+316367.912228796: ☑️ agreed by hfxsd.
  • 2024-08-15 03:57:43.098795541 +0000 UTC m=+413147.802265209: ☑️ agreed by lilin90.

cfzjywxk and others added 3 commits August 15, 2024 11:58
Co-authored-by: Lilian Lee <lilin@pingcap.com>
Co-authored-by: Lilian Lee <lilin@pingcap.com>
Co-authored-by: Lilian Lee <lilin@pingcap.com>
@hfxsd
Copy link
Collaborator

hfxsd commented Aug 15, 2024

/approve

Copy link

ti-chi-bot bot commented Aug 15, 2024

[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 Aug 15, 2024
@ti-chi-bot ti-chi-bot bot merged commit 604571d into pingcap:master Aug 15, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm size/S Denotes a PR that changes 10-29 lines, ignoring generated files. 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. v8.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants