Skip to content

Commit

Permalink
added detailed comment to explain the difference between Lock and Loc…
Browse files Browse the repository at this point in the history
…kWithoutHook
  • Loading branch information
ahrtr committed Mar 31, 2022
1 parent 4e2c1e2 commit d1ed7d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/storage/backend/batch_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ type BatchTx interface {
// CommitAndStop commits the previous tx and does not create a new one.
CommitAndStop()

// LockWithoutHook doesn't execute the `txPostLockHook`.
// LockWithoutHook doesn't execute the `txPostLockHook`, while the Lock method may
// call back the hook if present.
//
// The original Lock() is supposed to be called only by operations in the applying
// workflow, and all other operations should call LockWithoutHook(). If the operation
// doesn't have any impact on the applying workflow, such as the `etcdutl` commands,
// then it doesn't matter which lock method it calls.
LockWithoutHook()
}

Expand Down

0 comments on commit d1ed7d2

Please sign in to comment.