Skip to content

Commit

Permalink
comment: explain usage
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium committed Apr 7, 2024
1 parent ec6a614 commit 94f0c8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions txnkv/transaction/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,14 @@ func (txn *KVTxn) SetTxnSource(txnSource uint64) {

// SetSessionID sets the session ID of the transaction.
// If the committer is not initialized yet, the function won't take effect.
// It is supposed to be set before performing any writes in the transaction to avoid data race.
// It is designed to be called in ActivateTxn(), though subject to change.
// It is especially useful for pipelined transactions, as its committer is initialized immediately
// when the transaction is created.
//
// Note that commiter may also obtain a sessionID from context directly via sessionIDCtxKey.
// TODO: consider unifying them.

func (txn *KVTxn) SetSessionID(sessionID uint64) {
if txn.committer != nil {
txn.committer.sessionID = sessionID
Expand Down

0 comments on commit 94f0c8f

Please sign in to comment.