Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
59002: sql: don't overwrite ctx with nil on failure r=yuzefovich a=asubiotto

SetupLocalSyncFlow would return a nil ctx with an error in setupFlows if an
error occurred. The previous version would overwrite a ctx in the outer scope
just to return it. This commit no longer overwrites ctx and simply returns the
new ctx when there is no error. On master, this nil ctx would not have any
consequences although this commit is good hygiene, but 20.2 uses this ctx in a
defer, which would cause a panic.

Release note: None (no panic present on master)

Co-authored-by: Alfonso Subiotto Marques <[email protected]>
  • Loading branch information
craig[bot] and asubiotto committed Jan 15, 2021
2 parents a786c51 + 2096345 commit cd18042
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/sql/distsql_running.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,7 @@ func (dsp *DistSQLPlanner) setupFlows(
localReq := setupReq
localReq.Flow = *flows[thisNodeID]
defer physicalplan.ReleaseSetupFlowRequest(&localReq)
ctx, flow, err := dsp.distSQLSrv.SetupLocalSyncFlow(ctx, evalCtx.Mon, &localReq, recv, localState)
if err != nil {
return nil, nil, err
}

return ctx, flow, nil
return dsp.distSQLSrv.SetupLocalSyncFlow(ctx, evalCtx.Mon, &localReq, recv, localState)
}

// Run executes a physical plan. The plan should have been finalized using
Expand Down

0 comments on commit cd18042

Please sign in to comment.