Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium committed Nov 18, 2024
1 parent 5461693 commit 8ce525d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion txnkv/transaction/prewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ func (action actionPrewrite) handleSingleBatch(
// TiKV will return a PessimisticLockNotFound error directly if it encounters a different lock. Otherwise,
// TiKV returns lock.TTL = 0, and we still need to resolve the lock.
if (lock.TxnID > c.startTS && !c.isPessimistic) ||
c.txn.prewriteEncounterLockPolicy == TryResolvePolicy {
c.txn.prewriteEncounterLockPolicy == NoResolvePolicy {
return tikverr.NewErrWriteConflictWithArgs(
c.startTS,
lock.TxnID,
Expand Down
7 changes: 4 additions & 3 deletions txnkv/transaction/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@ func (e *tempLockBufferEntry) trySkipLockingOnRetry(returnValue bool, checkExist
// TxnOptions indicates the option when beginning a transaction.
// TxnOptions are set by the TxnOption values passed to Begin
type TxnOptions struct {
TxnScope string
StartTS *uint64
PipelinedMemDB bool
TxnScope string
StartTS *uint64
PipelinedMemDB bool
PrewriteEncounterLockPolicy PrewriteEncounterLockPolicy
}

// PrewriteEncounterLockPolicy specifies the policy when prewrite encounters locks.
type PrewriteEncounterLockPolicy int

const (
// TryResolvePolicy is the default one: try to resolve those locks with smaller startTS.
TryResolvePolicy PrewriteEncounterLockPolicy = iota
Expand Down

0 comments on commit 8ce525d

Please sign in to comment.