From 66a311c945dd153705a1071ed7ca086ee8671216 Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Mon, 4 Nov 2019 14:41:43 +0800 Subject: [PATCH] store/tikv: do not backoff when PessimisticLock return locked error (#13110) --- store/tikv/2pc.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/store/tikv/2pc.go b/store/tikv/2pc.go index 441447ff5b1dc..4a9a8d0948f4a 100644 --- a/store/tikv/2pc.go +++ b/store/tikv/2pc.go @@ -719,15 +719,12 @@ func (action actionPessimisticLock) handleSingleBatch(c *twoPhaseCommitter, bo * } locks = append(locks, lock) } - var expire int64 - expire, err = c.store.lockResolver.ResolveLocks(bo, c.startTS, locks) + // Because we already waited on tikv, no need to Backoff here. + _, err = c.store.lockResolver.ResolveLocks(bo, c.startTS, locks) if err != nil { return errors.Trace(err) } - if err1 := bo.BackoffWithMaxSleep(BoTxnLock, int(expire), errors.New(locks[0].String())); err1 != nil { - return err1 - } // Handle the killed flag when waiting for the pessimistic lock. // When a txn runs into LockKeys() and backoff here, it has no chance to call // executor.Next() and check the killed flag.