statement level deadlock retry
Open
type/enhancement
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
The current TiDB supports retry when a deadlock occurs within a single [`LockKeys`](https://github.com/tikv/client-go/blob/31ecc4222973e34e713d09ad7287dc3a512d31a6/txnkv/transaction/txn.go#L1325) call.
Additionally, some certain statements can invoke `LockKeys` multiple times. If a deadlock is detected across two or more `LockKeys` calls, it's also safe to automatically retry such statements if we can clean up the pessimistic locks.
Select-lock and batch-point-get lock statements lock keys in a single `LockKeys` call so it's ok.
The statements which can invoke `LockKeys` multiple times:
- Point Get
- Foreign Key Locks
Contributor guide
Assessment
This issue has not been assessed yet.