Skip to content

Commit

Permalink
server: add connection id for lock keys committer (pingcap#15685)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfzjywxk authored Mar 27, 2020
1 parent 0d10f91 commit 78ac219
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ func doLockKeys(ctx context.Context, se sessionctx.Context, lockCtx *kv.LockCtx,
if err != nil {
return err
}
return txn.LockKeys(ctx, lockCtx, keys...)
return txn.LockKeys(sessionctx.SetCommitCtx(ctx, se), lockCtx, keys...)
}

// LimitExec represents limit executor
Expand Down
2 changes: 1 addition & 1 deletion sessionctx/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type connIDCtxKeyType struct{}
// ConnID is the key in context.
var ConnID = connIDCtxKeyType{}

// SetCommitCtx sets the variables for context before commit a transaction.
// SetCommitCtx sets connection id into context
func SetCommitCtx(ctx context.Context, sessCtx Context) context.Context {
return context.WithValue(ctx, ConnID, sessCtx.GetSessionVars().ConnectionID)
}

0 comments on commit 78ac219

Please sign in to comment.