txn: implement rollback, cleanup and lock resolving for shared locks#19149
txn: implement rollback, cleanup and lock resolving for shared locks#19149you06 merged 7 commits intotikv:tikv-8.5-with-shared-lockfrom
Conversation
Signed-off-by: zyguan <zhongyangguan@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
| // `protected` is always false for a shared lock | ||
| assert!(!key.is_encoded_from(&lock.primary)); |
There was a problem hiding this comment.
Is it guaranteed that a shared lock is never the primary of a 2PC transaction?
There was a problem hiding this comment.
🤔 If so, then how does it determine the primary when a transaction's first batch of locks are shared locks?
There was a problem hiding this comment.
It's fine for foreign key usage because the shared lock(parent table) is always acquired after an exclusive lock(child table).
For select for share usage, we may unlock this limitation or use a fake primary key (e.g. pk_start_ts).
There was a problem hiding this comment.
And for simplicity, it doesn't acquire exclusive lock and share lock in one rpc call by now.
Signed-off-by: you06 <you1474600@gmail.com>
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 |
Signed-off-by: you06 <you1474600@gmail.com>
…ikv#19149) * txn: partially support shared lock for lock resolving Signed-off-by: zyguan <zhongyangguan@gmail.com> * add test for resolving locks Signed-off-by: you06 <you1474600@gmail.com> * impl pessimistic rollback Signed-off-by: you06 <you1474600@gmail.com> * fix lock test Signed-off-by: you06 <you1474600@gmail.com> * fix scan lock & address comment Signed-off-by: you06 <you1474600@gmail.com> * impl resolve lock read phases & add tests Signed-off-by: you06 <you1474600@gmail.com> * do not cast embed locks to shared types Signed-off-by: you06 <you1474600@gmail.com> --------- Signed-off-by: zyguan <zhongyangguan@gmail.com> Signed-off-by: you06 <you1474600@gmail.com> Co-authored-by: zyguan <zhongyangguan@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