@@ -506,11 +506,11 @@ func (s *ShardStore) resolveTxnLockForKey(ctx context.Context, g *ShardGroup, ke
506506 // Defensive check: While uint64 overflow is not expected in normal operation,
507507 // this handles the edge case where startTS==^uint64(0) or a bug causes overflow.
508508 // Prevents violating the FSM invariant resolveTS > startTS (fsm.go:258).
509- return errors . Wrapf ( ErrTxnLocked , "key: %s ( timestamp overflow)" , string ( key ) )
509+ return NewTxnLockedErrorWithDetail ( key , "timestamp overflow" )
510510 }
511511 return applyTxnResolution (g , pb .Phase_ABORT , lock .StartTS , abortTS , lock .PrimaryKey , [][]byte {key })
512512 case txnStatusPending :
513- return errors . Wrapf ( ErrTxnLocked , " key: %s" , string ( key ) )
513+ return NewTxnLockedError ( key )
514514 default :
515515 return errors .Wrapf (ErrTxnInvalidMeta , "unknown txn status for key %s" , string (key ))
516516 }
@@ -669,13 +669,13 @@ func (s *ShardStore) cachedLockTxnStatus(ctx context.Context, plan *scanLockPlan
669669func lockResolutionForStatus (state lockTxnStatus , lock txnLock , key []byte , cleanupNow uint64 ) (pb.Phase , uint64 , error ) {
670670 switch state .status {
671671 case txnStatusPending :
672- return pb .Phase_NONE , 0 , errors . Wrapf ( ErrTxnLocked , " key: %s" , string ( key ) )
672+ return pb .Phase_NONE , 0 , NewTxnLockedError ( key )
673673 case txnStatusCommitted :
674674 return pb .Phase_COMMIT , state .commitTS , nil
675675 case txnStatusRolledBack :
676676 abortTS := cleanupTSWithNow (lock .StartTS , cleanupNow )
677677 if abortTS <= lock .StartTS {
678- return pb .Phase_NONE , 0 , errors . Wrapf ( ErrTxnLocked , "key: %s ( timestamp overflow)" , string ( key ) )
678+ return pb .Phase_NONE , 0 , NewTxnLockedErrorWithDetail ( key , "timestamp overflow" )
679679 }
680680 return pb .Phase_ABORT , abortTS , nil
681681 default :
0 commit comments