mirror of
https://github.com/postgres/postgres.git
synced 2026-02-03 20:40:14 -05:00
Commit b0b0d84b3d purported to make it
possible to relaunch workers using the same parallel context, but it had
an unpleasant race condition: we might reinitialize after the workers
have sent their last control message but before they have dettached the
DSM, leaving to crashes. Repair by introducing a new ParallelContext
operation, ReinitializeParallelDSM.
Adjust execParallel.c to use this new support, so that we can rescan a
Gather node by relaunching workers but without needing to recreate the
DSM.
Amit Kapila, with some adjustments by me. Extracted from latest parallel
sequential scan patch.
38 lines
1.2 KiB
C
38 lines
1.2 KiB
C
/*--------------------------------------------------------------------
|
|
* execParallel.h
|
|
* POSTGRES parallel execution interface
|
|
*
|
|
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* IDENTIFICATION
|
|
* src/include/executor/execParallel.h
|
|
*--------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef EXECPARALLEL_H
|
|
#define EXECPARALLEL_H
|
|
|
|
#include "access/parallel.h"
|
|
#include "nodes/execnodes.h"
|
|
#include "nodes/parsenodes.h"
|
|
#include "nodes/plannodes.h"
|
|
|
|
typedef struct SharedExecutorInstrumentation SharedExecutorInstrumentation;
|
|
|
|
typedef struct ParallelExecutorInfo
|
|
{
|
|
PlanState *planstate;
|
|
ParallelContext *pcxt;
|
|
BufferUsage *buffer_usage;
|
|
SharedExecutorInstrumentation *instrumentation;
|
|
shm_mq_handle **tqueue;
|
|
} ParallelExecutorInfo;
|
|
|
|
extern ParallelExecutorInfo *ExecInitParallelPlan(PlanState *planstate,
|
|
EState *estate, int nworkers);
|
|
extern void ExecParallelFinish(ParallelExecutorInfo *pei);
|
|
extern void ExecParallelCleanup(ParallelExecutorInfo *pei);
|
|
extern shm_mq_handle **ExecParallelReinitializeTupleQueues(ParallelContext *pcxt);
|
|
|
|
#endif /* EXECPARALLEL_H */
|