]> granicus.if.org Git - postgresql/commitdiff
Pass eflags down to parallel workers.
authorRobert Haas <rhaas@postgresql.org>
Mon, 20 Nov 2017 17:00:33 +0000 (12:00 -0500)
committerRobert Haas <rhaas@postgresql.org>
Mon, 20 Nov 2017 17:00:33 +0000 (12:00 -0500)
Currently, there are no known consequences of this oversight, so no
back-patch.  Several of the EXEC_FLAG_* constants aren't usable in
parallel mode anyway, and potential problems related to the presence
or absence of OIDs (see EXEC_FLAG_WITH_OIDS, EXEC_FLAG_WITHOUT_OIDS)
seem at present to be masked by the unconditional projection step
performed by Gather and Gather Merge.  In general, however, it seems
important that all participants agree on the values of these flags,
which modify executor behavior globally, and a pending patch to skip
projection in Gather (Merge) would be outright broken in certain cases
without this fix.

Patch by me, based on investigation of a test case provided by Amit
Kapila.  This patch was also reviewed by Amit Kapila.

Discussion: http://postgr.es/m/CA+TgmoZ0ZL=cesZFq8c9NnfK6bqy-wwUd3_74iYGodYrSoQ7Fw@mail.gmail.com

src/backend/executor/execParallel.c

index 2ead32d5ad5d0f28199accbd9342156cc35edf87..53c5254be13c43b8a2959a04c68ed2bcf97be11b 100644 (file)
@@ -69,6 +69,7 @@ typedef struct FixedParallelExecutorState
 {
        int64           tuples_needed;  /* tuple bound, see ExecSetTupleBound */
        dsa_pointer param_exec;
+       int                     eflags;
 } FixedParallelExecutorState;
 
 /*
@@ -647,6 +648,7 @@ ExecInitParallelPlan(PlanState *planstate, EState *estate,
        fpes = shm_toc_allocate(pcxt->toc, sizeof(FixedParallelExecutorState));
        fpes->tuples_needed = tuples_needed;
        fpes->param_exec = InvalidDsaPointer;
+       fpes->eflags = estate->es_top_eflags;
        shm_toc_insert(pcxt->toc, PARALLEL_KEY_EXECUTOR_FIXED, fpes);
 
        /* Store query string */
@@ -1224,7 +1226,7 @@ ParallelQueryMain(dsm_segment *seg, shm_toc *toc)
        area = dsa_attach_in_place(area_space, seg);
 
        /* Start up the executor */
-       ExecutorStart(queryDesc, 0);
+       ExecutorStart(queryDesc, fpes->eflags);
 
        /* Special executor initialization steps for parallel workers */
        queryDesc->planstate->state->es_query_dsa = area;