Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-22.1: distsql: create LeafTxn eagerly for local flow of a distributed plan #82841

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/sql/distsql/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,10 @@ func (ds *ServerImpl) setupFlow(
var evalCtx *tree.EvalContext
var leafTxn *kv.Txn
if localState.EvalContext != nil {
// If we're running on the gateway, then we'll reuse already existing
// eval context. This is the case even if the query is distributed -
// this allows us to avoid an unnecessary deserialization of the eval
// context proto.
evalCtx = localState.EvalContext
// We're about to mutate the evalCtx and we want to restore its original
// state once the flow cleans up. Note that we could have made a copy of
Expand All @@ -308,7 +312,7 @@ func (ds *ServerImpl) setupFlow(
evalCtx.Txn = origTxn
}
evalCtx.Mon = monitor
if localState.HasConcurrency {
if localState.MustUseLeafTxn() {
var err error
leafTxn, err = makeLeaf()
if err != nil {
Expand Down