mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
Rewrite interaction of parallel mode with parallel executor support.
In the previous coding, before returning from ExecutorRun, we'd shut
down all parallel workers. This was dead wrong if ExecutorRun was
called with a non-zero tuple count; it had the effect of truncating
the query output. To fix, give ExecutePlan control over whether to
enter parallel mode, and have it refuse to do so if the tuple count
is non-zero. Rewrite the Gather logic so that it can cope with being
called outside parallel mode.
Commit 7aea8e4f2d
is largely to blame
for this problem, though this patch modifies some subsequently-committed
code which relied on the guarantees it purported to make.
This commit is contained in:
@ -442,6 +442,23 @@ ExecParallelFinish(ParallelExecutorInfo *pei)
|
||||
pei->instrumentation);
|
||||
}
|
||||
|
||||
/*
|
||||
* Clean up whatever ParallelExecutreInfo resources still exist after
|
||||
* ExecParallelFinish. We separate these routines because someone might
|
||||
* want to examine the contents of the DSM after ExecParallelFinish and
|
||||
* before calling this routine.
|
||||
*/
|
||||
void
|
||||
ExecParallelCleanup(ParallelExecutorInfo *pei)
|
||||
{
|
||||
if (pei->pcxt != NULL)
|
||||
{
|
||||
DestroyParallelContext(pei->pcxt);
|
||||
pei->pcxt = NULL;
|
||||
}
|
||||
pfree(pei);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a DestReceiver to write tuples we produce to the shm_mq designated
|
||||
* for that purpose.
|
||||
|
Reference in New Issue
Block a user