Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit88fdc70

Browse files
committed
Fix possible infinite loop with Parallel Append.
When the previously-chosen plan was non-partial, all pa_finishedflags for partial plans are now set, and pa_next_plan has not yetbeen set to INVALID_SUBPLAN_INDEX, the previous code could go intoan infinite loop.Report by Rajkumar Raghuwanshi. Patch by Amit Khandekar and me.Review by Kyotaro Horiguchi.Discussion:http://postgr.es/m/CAJ3gD9cf43z78qY=U=H0HvOEN341qfRO-vLpnKPSviHeWgJQ5w@mail.gmail.com
1 parentb3a101e commit88fdc70

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎src/backend/executor/nodeAppend.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ choose_next_subplan_for_worker(AppendState *node)
473473
return false;
474474
}
475475

476+
/* Save the plan from which we are starting the search. */
477+
node->as_whichplan=pstate->pa_next_plan;
478+
476479
/* Loop until we find a subplan to execute. */
477480
while (pstate->pa_finished[pstate->pa_next_plan])
478481
{
@@ -481,14 +484,17 @@ choose_next_subplan_for_worker(AppendState *node)
481484
/* Advance to next plan. */
482485
pstate->pa_next_plan++;
483486
}
484-
elseif (append->first_partial_plan<node->as_nplans)
487+
elseif (node->as_whichplan>append->first_partial_plan)
485488
{
486489
/* Loop back to first partial plan. */
487490
pstate->pa_next_plan=append->first_partial_plan;
488491
}
489492
else
490493
{
491-
/* At last plan, no partial plans, arrange to bail out. */
494+
/*
495+
* At last plan, and either there are no partial plans or we've
496+
* tried them all. Arrange to bail out.
497+
*/
492498
pstate->pa_next_plan=node->as_whichplan;
493499
}
494500

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp