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

Commit965a16f

Browse files
committed
Fix mistaken failure to allow parallelism in corner case.
If we try to run a parallel plan in serial mode because, for example,it's going to be scanned via a cursor, but for some reason we'realready in parallel mode (for example because an outer query isrunning in parallel), we'd incorrectly try to launch workers.Fix by adding a flag to the EState, so that we can be certain thatExecutePlan() and ExecGather()/ExecGatherMerge() will have the sameidea about whether we are executing serially or in parallel.Report and fix by Amit Kapila with help from Kuntal Ghosh. A fewtweaks by me.Discussion:http://postgr.es/m/CAA4eK1+_BuZrmVCeua5Eqnm4Co9DAXdM5HPAOE2J19ePbR912Q@mail.gmail.com
1 parent6a81ba1 commit965a16f

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

‎src/backend/executor/execMain.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,7 @@ ExecutePlan(EState *estate,
17041704
if (!execute_once||dest->mydest==DestIntoRel)
17051705
use_parallel_mode= false;
17061706

1707+
estate->es_use_parallel_mode=use_parallel_mode;
17071708
if (use_parallel_mode)
17081709
EnterParallelMode();
17091710

‎src/backend/executor/execUtils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ CreateExecutorState(void)
156156
estate->es_epqScanDone=NULL;
157157
estate->es_sourceText=NULL;
158158

159+
estate->es_use_parallel_mode= false;
160+
159161
/*
160162
* Return the executor state structure
161163
*/

‎src/backend/executor/nodeGather.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ ExecGather(PlanState *pstate)
149149
* Sometimes we might have to run without parallelism; but if parallel
150150
* mode is active then we can try to fire up some workers.
151151
*/
152-
if (gather->num_workers>0&&IsInParallelMode())
152+
if (gather->num_workers>0&&estate->es_use_parallel_mode)
153153
{
154154
ParallelContext*pcxt;
155155

‎src/backend/executor/nodeGatherMerge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ ExecGatherMerge(PlanState *pstate)
193193
* Sometimes we might have to run without parallelism; but if parallel
194194
* mode is active then we can try to fire up some workers.
195195
*/
196-
if (gm->num_workers>0&&IsInParallelMode())
196+
if (gm->num_workers>0&&estate->es_use_parallel_mode)
197197
{
198198
ParallelContext*pcxt;
199199

‎src/include/nodes/execnodes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,8 @@ typedef struct EState
507507
bool*es_epqTupleSet;/* true if EPQ tuple is provided */
508508
bool*es_epqScanDone;/* true if EPQ tuple has been fetched */
509509

510+
booles_use_parallel_mode;/* can we use parallel workers? */
511+
510512
/* The per-query shared memory area to use for parallel execution. */
511513
structdsa_area*es_query_dsa;
512514
}EState;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp