-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
system-variables.md
Outdated
- 是否持久化到集群:是 | ||
- 类型:布尔型 | ||
- 默认值:`OFF` | ||
- 该变量用于控制是否启用共享锁升级为排他锁的功能。当该变量值为 `ON` 时,TiDB 会尝试将共享锁升级为排他锁,以减少死锁的概率。该变量默认值为 `OFF`,表示不启用共享锁升级为排他锁的功能。注意该变量不可和 [`tidb_enable_noop_functions`](#tidb_enable_noop_functions-span-classversion-mark从-v40-版本开始引入span) 同时开启。 |
There was a problem hiding this comment.
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 应该以这个变量为准?
There was a problem hiding this comment.
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 那里有检查
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
描述已修改
Signed-off-by: cfzjywxk <cfzjywxk@gmail.com>
2da0067
to
5c9e67e
Compare
tidb_enable_shared_lock_upgrade
related doc change
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
Co-authored-by: xixirangrang <hfxsd@hotmail.com>
pessimistic-transaction.md
Outdated
使用这个语句执行的时候,效果和没有加锁是一样的,不会阻塞其他事务的读写。 | ||
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` 语句,对数据行加悲观锁。 |
There was a problem hiding this comment.
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
的功能、后面再补充解释比较好?另外后面的“升级”这个表述感觉对用户来说可能也不是很好理解
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
Co-authored-by: MyonKeminta <9948422+MyonKeminta@users.noreply.github.com>
@joey-yez PTAL again |
tidb_enable_shared_lock_upgrade
related doc changetidb_enable_shared_lock_promotion
related doc change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
Co-authored-by: Lilian Lee <lilin@pingcap.com>
Co-authored-by: Lilian Lee <lilin@pingcap.com>
Co-authored-by: Lilian Lee <lilin@pingcap.com>
/approve |
[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 |
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 tofor 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).
What is the related PR or file link(s)?
Do your changes match any of the following descriptions?