Skip to content

Commit 55ff106

Browse files
committed
Handle missing lock as conflict and abort transaction
1 parent 91a2988 commit 55ff106

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

kv/fsm.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,8 @@ func (f *kvFSM) handleCommitRequest(ctx context.Context, r *pb.Request) error {
209209
}
210210

211211
if !ok {
212-
// Lock missing (e.g., expired). Try to reacquire to make progress.
213-
err := f.lockStore.TxnWithTTL(ctx, func(ctx context.Context, ttlTxn store.TTLTxn) error {
214-
return f.lock(ttlTxn, mut.Key, r.Ts)
215-
})
216-
if err != nil {
217-
return errors.WithStack(err)
218-
}
212+
// Lock already gone: treat as conflict and abort.
213+
return errors.WithStack(ErrKeyNotLocked)
219214
}
220215

221216
err = f.commit(ctx, txn, mut)

0 commit comments

Comments
 (0)