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: support upgrade for share clause to for update #55022

Closed
cfzjywxk opened this issue Jul 29, 2024 · 0 comments · Fixed by #55023
Closed

txn: support upgrade for share clause to for update #55022

cfzjywxk opened this issue Jul 29, 2024 · 0 comments · Fixed by #55023
Labels
sig/transaction SIG:Transaction type/feature-request Categorizes issue or PR as related to a new feature.

Comments

@cfzjywxk
Copy link
Contributor

cfzjywxk commented Jul 29, 2024

Feature Request

Is your feature request related to a problem? Please describe:

TiDB does not support Shared Lock. If we enable the compatibility by tidb_enable_noop_functions, TiDB can ignore the shared lock.

To make the for share statements acquire pessimistic locks as needed, a new mechanism is needed.

Describe the feature you'd like:

Introduce a new variable tidb_enable_shared_lock_upgrade to control whether the for share should acquire locks as the for update does.

tidb_enable_shared_lock_promotion
- Scope: GLOBAL | SESSION
- Persists to cluster: Yes
- Type: Boolean
- Default value: false
- Value options: true, false
- This variable indicate whether TiDB promotes Shared Lock to Exclusive Lock. When you set the variable to true, the statements SELECT ... FOR SHARE and SELECT ... LOCK IN SHARE MODE will be processed as SELECT ... FOR UPDATE. 

When it's enabled

Describe alternatives you've considered:

Implement the complete for share feature, it's quite complex and resource consuming.

Teachability, Documentation, Adoption, Migration Strategy:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/transaction SIG:Transaction type/feature-request Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant