mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Fix Parallel Append crash.
Reported by Tom Lane and the buildfarm. Amul Sul and Amit Khandekar Discussion: http://postgr.es/m/17868.1512519318@sss.pgh.pa.us Discussion: http://postgr.es/m/CAJ3gD9cJQ4d-XhmZ6BqM9rMM2KDBfpkdgOAb4+psz56uBuMQ_A@mail.gmail.com
This commit is contained in:
@ -506,8 +506,16 @@ choose_next_subplan_for_worker(AppendState *node)
|
|||||||
node->as_whichplan = pstate->pa_next_plan++;
|
node->as_whichplan = pstate->pa_next_plan++;
|
||||||
if (pstate->pa_next_plan >= node->as_nplans)
|
if (pstate->pa_next_plan >= node->as_nplans)
|
||||||
{
|
{
|
||||||
Assert(append->first_partial_plan < node->as_nplans);
|
if (append->first_partial_plan < node->as_nplans)
|
||||||
pstate->pa_next_plan = append->first_partial_plan;
|
pstate->pa_next_plan = append->first_partial_plan;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* We have only non-partial plans, and we already chose the last
|
||||||
|
* one; so arrange for the other workers to immediately bail out.
|
||||||
|
*/
|
||||||
|
pstate->pa_next_plan = INVALID_SUBPLAN_INDEX;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If non-partial, immediately mark as finished. */
|
/* If non-partial, immediately mark as finished. */
|
||||||
|
Reference in New Issue
Block a user