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

[wip] object pooling in the distsql planning path #30556

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
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: 3 additions & 3 deletions pkg/ccl/changefeedccl/changefeed_dist.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func distChangefeedFlow(
spanPartitions = []sql.SpanPartition{{Node: gatewayNodeID, Spans: trackedSpans}}
} else {
// All other feeds get a ChangeAggregator local on the leaseholder.
spanPartitions, err = dsp.PartitionSpans(&planCtx, trackedSpans)
spanPartitions, err = dsp.PartitionSpans(planCtx, trackedSpans)
if err != nil {
return err
}
Expand Down Expand Up @@ -158,7 +158,7 @@ func distChangefeedFlow(

p.ResultTypes = changefeedResultTypes
p.PlanToStreamColMap = []int{1, 2, 3}
dsp.FinalizePlan(&planCtx, &p)
dsp.FinalizePlan(planCtx, &p)

resultRows := makeChangefeedResultWriter(resultsCh)
recv := sql.MakeDistSQLReceiver(
Expand All @@ -184,7 +184,7 @@ func distChangefeedFlow(
finishedSetupFn = func() { resultsCh <- tree.Datums(nil) }
}

dsp.Run(&planCtx, noTxn, &p, recv, evalCtx, finishedSetupFn)
dsp.Run(planCtx, noTxn, &p, recv, evalCtx, finishedSetupFn)
return resultRows.Err()
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/backfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,13 @@ func (sc *SchemaChanger) distBackfill(
)
planCtx := sc.distSQLPlanner.NewPlanningCtx(ctx, evalCtx, txn)
plan, err := sc.distSQLPlanner.createBackfiller(
&planCtx, backfillType, *tableDesc, duration, chunkSize, spans, otherTableDescs, sc.readAsOf,
planCtx, backfillType, *tableDesc, duration, chunkSize, spans, otherTableDescs, sc.readAsOf,
)
if err != nil {
return err
}
sc.distSQLPlanner.Run(
&planCtx,
planCtx,
nil, /* txn - the processors manage their own transactions */
&plan, recv, evalCtx,
nil, /* finishedSetupFn */
Expand Down
5 changes: 3 additions & 2 deletions pkg/sql/conn_executor_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,10 @@ func (ex *connExecutor) execWithDistSQLEngine(
},
&ex.sessionTracing,
)
defer recv.Release()

evalCtx := planner.ExtendedEvalContext()
var planCtx PlanningCtx
var planCtx *PlanningCtx
if distribute {
planCtx = ex.server.cfg.DistSQLPlanner.NewPlanningCtx(ctx, evalCtx, planner.txn)
} else {
Expand All @@ -981,7 +982,7 @@ func (ex *connExecutor) execWithDistSQLEngine(
// We pass in whether or not we wanted to distribute this plan, which tells
// the planner whether or not to plan remote table readers.
ex.server.cfg.DistSQLPlanner.PlanAndRun(
ctx, evalCtx, &planCtx, planner.txn, planner.curPlan.plan, recv)
ctx, evalCtx, planCtx, planner.txn, planner.curPlan.plan, recv)
return recv.commErr
}

Expand Down
Loading