client-go
client-go copied to clipboard
PessimisticLock: Lock the specified key only if the key exists
1. current process Currently, TiKV locks the specified keys for pessimistic lock requests whether it exists or not. TiDB sends a get request to judge whether the keys exists on the TiKV firstly, then sends a pessimistic lock request to TiKV if the key exists, It makes and additional rpc request.
2. what changed
We add a flag LockIfExists
for pessimistic lock request and TiKV will check the flag to decide how to execute the lock process.
This PR is depended on the PRs bellow.
- [ ] https://github.com/pingcap/kvproto/pull/963
- [ ] https://github.com/tikv/tikv/issues/13210