Skip to content

Commit

Permalink
store/tikv: do not backoff when PessimisticLock return locked error (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Nov 4, 2019
1 parent 7939e6f commit 7e70044
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions store/tikv/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -789,14 +789,12 @@ func (action actionPessimisticLock) handleSingleBatch(c *twoPhaseCommitter, bo *
}
locks = append(locks, lock)
}
expire, err := c.store.lockResolver.ResolveLocks(bo, locks)
// Because we already waited on tikv, no need to Backoff here.
_, err = c.store.lockResolver.ResolveLocks(bo, 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.
Expand Down

0 comments on commit 7e70044

Please sign in to comment.