From 3d20ce5a9729ac189ea252ab9e6682425b10e65f Mon Sep 17 00:00:00 2001 From: Jane Xing Date: Mon, 3 Apr 2023 15:39:38 -0400 Subject: [PATCH] sql: correctly set inner plan for leafTxn when resuming flow for portal When resuming a portal, we always reset the planner. However we still need the planner to respect the outer txn's situation, as we did in #98120. Release note: None --- pkg/sql/planner.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/sql/planner.go b/pkg/sql/planner.go index 2434b2246ba9..e6076bd1dc27 100644 --- a/pkg/sql/planner.go +++ b/pkg/sql/planner.go @@ -283,7 +283,11 @@ func (p *planner) resumeFlowForPausablePortal(recv *DistSQLReceiver) error { } recv.discardRows = p.instrumentation.ShouldDiscardRows() recv.outputTypes = p.pausablePortal.pauseInfo.resumableFlow.outputTypes - p.pausablePortal.pauseInfo.resumableFlow.flow.Resume(recv) + flow := p.pausablePortal.pauseInfo.resumableFlow.flow + finishedSetupFn, cleanup := getFinishedSetupFn(p) + finishedSetupFn(flow) + defer cleanup() + flow.Resume(recv) return recv.commErr }