Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit acf555b

Browse files
committed
Shut down Gather's children before shutting down Gather itself.
It turns out that the original shutdown order here does not work well. Multiple people attempting to develop further parallel query patches have discovered that they need to do cleanup before the DSM goes away, and you can't do that if the parent node gets cleaned up first. Patch by me, reviewed by KaiGai Kohei and Dilip Kumar. Discussion: http://postgr.es/m/CA+TgmoY6bOc1YnhcAQnMfCBDbsJzROQ3sYxSAL-SYB5tMJcTKg@mail.gmail.com Discussion: http://postgr.es/m/9A28C8860F777E439AA12E8AEA7694F8012AEB82@BPXM15GP.gisp.nec.co.jp Discussion: http://postgr.es/m/CA+TgmoYuPOc=+xrG1v0fCsoLbKAab9F1ddOeaaiLMzKOiBar1Q@mail.gmail.com
1 parent d912dd0 commit acf555b

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/backend/executor/execProcnode.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,8 @@ ExecShutdownNode(PlanState *node)
815815
if (node == NULL)
816816
return false;
817817

818+
planstate_tree_walker(node, ExecShutdownNode, NULL);
819+
818820
switch (nodeTag(node))
819821
{
820822
case T_GatherState:
@@ -824,5 +826,5 @@ ExecShutdownNode(PlanState *node)
824826
break;
825827
}
826828

827-
return planstate_tree_walker(node, ExecShutdownNode, NULL);
829+
return false;
828830
}

src/backend/executor/nodeGather.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ ExecGather(GatherState *node)
229229
void
230230
ExecEndGather(GatherState *node)
231231
{
232+
ExecEndNode(outerPlanState(node)); /* let children clean up first */
232233
ExecShutdownGather(node);
233234
ExecFreeExprContext(&node->ps);
234235
ExecClearTuple(node->ps.ps_ResultTupleSlot);
235-
ExecEndNode(outerPlanState(node));
236236
}
237237

238238
/*

0 commit comments

Comments
 (0)