txn: support shared lock for lock wait table#19271
txn: support shared lock for lock wait table#19271ti-chi-bot[bot] merged 6 commits intotikv:masterfrom
Conversation
* implement lock waiting queue Signed-off-by: you06 <you1474600@gmail.com> * donot track shared lock in deadlock detector Signed-off-by: you06 <you1474600@gmail.com> * support lock wakeup for shared lock Signed-off-by: you06 <you1474600@gmail.com> * fmt code Signed-off-by: you06 <you1474600@gmail.com> * rename param Signed-off-by: you06 <you1474600@gmail.com> * remove unused test function Signed-off-by: you06 <you1474600@gmail.com> * boxed LockWaitEntry Signed-off-by: you06 <you1474600@gmail.com> --------- Signed-off-by: you06 <you1474600@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for shared locks in the lock wait table, enabling multiple waiters for shared locks to be woken up simultaneously when a conflicting lock is released. This is preparatory work for full shared lock support.
Key changes:
- Extended
AcquirePessimisticLockcommand to accept 3-tuple keys (key, should_not_exist, is_shared_lock) - Modified lock wait queue to group and wake up consecutive shared lock waiters together
- Added detection and handling for shared lock commands to disable in-memory pessimistic lock optimization
- Excluded shared locks from deadlock detection
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/storage/txn/commands/acquire_pessimistic_lock.rs |
Updated key tuple format to include is_shared_lock flag |
src/storage/lock_manager/lock_waiting_queue.rs |
Implemented group wake-up logic for consecutive shared lock waiters |
src/storage/txn/scheduler.rs |
Added shared lock command detection and modified wake-up handling to process multiple entries |
src/server/lock_manager/mod.rs |
Excluded shared locks from deadlock detection |
src/storage/mod.rs |
Updated test helper functions to support new 3-tuple format |
src/storage/txn/commands/mod.rs |
Updated protocol buffer conversion to extract shared lock flag |
tests/failpoints/cases/test_storage.rs |
Updated test cases to use new 3-tuple format |
| Multiple test files | Added is_shared_lock field initialization in test code |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
|
/retest |
Signed-off-by: you06 <you1474600@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, zyguan The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
The clippy failed because aws-sdk-s3 is pinned to |
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
| # aws-sdk-s3 transitively depends on lru 0.12.x, which triggers | ||
| # RUSTSEC-2026-0002 (Stacked Borrows UB). Upstream dependency | ||
| # constraints prevent upgrading at the moment. | ||
| "RUSTSEC-2026-0002", |
|
/retest |
ref tikv#19249 Fix the CI by ignoring `RUSTSEC-2026-0002`. Signed-off-by: you06 <you1474600@gmail.com>
ref tikv#19087 Handle the shared lock in the lock wait table. Signed-off-by: you06 <you1474600@gmail.com>
What is changed and how it works?
Issue Number: ref #19087
What's Changed:
Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note