* is allocated and initialized by executor; that is, after ExecutorStart().
*/
static bool
-ExecParallelInitializeWorker(PlanState *planstate, shm_toc *toc)
+ExecParallelInitializeWorker(PlanState *planstate, ParallelWorkerContext *pwcxt)
{
if (planstate == NULL)
return false;
{
case T_SeqScanState:
if (planstate->plan->parallel_aware)
- ExecSeqScanInitializeWorker((SeqScanState *) planstate, toc);
+ ExecSeqScanInitializeWorker((SeqScanState *) planstate, pwcxt);
break;
case T_IndexScanState:
if (planstate->plan->parallel_aware)
- ExecIndexScanInitializeWorker((IndexScanState *) planstate, toc);
+ ExecIndexScanInitializeWorker((IndexScanState *) planstate,
+ pwcxt);
break;
case T_IndexOnlyScanState:
if (planstate->plan->parallel_aware)
- ExecIndexOnlyScanInitializeWorker((IndexOnlyScanState *) planstate, toc);
+ ExecIndexOnlyScanInitializeWorker((IndexOnlyScanState *) planstate,
+ pwcxt);
break;
case T_ForeignScanState:
if (planstate->plan->parallel_aware)
ExecForeignScanInitializeWorker((ForeignScanState *) planstate,
- toc);
+ pwcxt);
break;
case T_CustomScanState:
if (planstate->plan->parallel_aware)
ExecCustomScanInitializeWorker((CustomScanState *) planstate,
- toc);
+ pwcxt);
break;
case T_BitmapHeapScanState:
if (planstate->plan->parallel_aware)
- ExecBitmapHeapInitializeWorker((BitmapHeapScanState *) planstate, toc);
+ ExecBitmapHeapInitializeWorker((BitmapHeapScanState *) planstate,
+ pwcxt);
break;
case T_SortState:
/* even when not parallel-aware */
- ExecSortInitializeWorker((SortState *) planstate, toc);
+ ExecSortInitializeWorker((SortState *) planstate, pwcxt);
break;
default:
break;
}
- return planstate_tree_walker(planstate, ExecParallelInitializeWorker, toc);
+ return planstate_tree_walker(planstate, ExecParallelInitializeWorker,
+ pwcxt);
}
/*
int instrument_options = 0;
void *area_space;
dsa_area *area;
+ ParallelWorkerContext pwcxt;
/* Get fixed-size state. */
fpes = shm_toc_lookup(toc, PARALLEL_KEY_EXECUTOR_FIXED, false);
RestoreParamExecParams(paramexec_space, queryDesc->estate);
}
- ExecParallelInitializeWorker(queryDesc->planstate, toc);
+ pwcxt.toc = toc;
+ pwcxt.seg = seg;
+ ExecParallelInitializeWorker(queryDesc->planstate, &pwcxt);
/* Pass down any tuple bound */
ExecSetTupleBound(fpes->tuples_needed, queryDesc->planstate);
* ----------------------------------------------------------------
*/
void
-ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node, shm_toc *toc)
+ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node,
+ ParallelWorkerContext *pwcxt)
{
ParallelBitmapHeapState *pstate;
Snapshot snapshot;
- pstate = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
+ pstate = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
node->pstate = pstate;
snapshot = RestoreSnapshot(pstate->phs_snapshot_data);
}
void
-ExecCustomScanInitializeWorker(CustomScanState *node, shm_toc *toc)
+ExecCustomScanInitializeWorker(CustomScanState *node,
+ ParallelWorkerContext *pwcxt)
{
const CustomExecMethods *methods = node->methods;
int plan_node_id = node->ss.ps.plan->plan_node_id;
void *coordinate;
- coordinate = shm_toc_lookup(toc, plan_node_id, false);
- methods->InitializeWorkerCustomScan(node, toc, coordinate);
+ coordinate = shm_toc_lookup(pwcxt->toc, plan_node_id, false);
+ methods->InitializeWorkerCustomScan(node, pwcxt->toc, coordinate);
}
}
* ----------------------------------------------------------------
*/
void
-ExecForeignScanInitializeWorker(ForeignScanState *node, shm_toc *toc)
+ExecForeignScanInitializeWorker(ForeignScanState *node,
+ ParallelWorkerContext *pwcxt)
{
FdwRoutine *fdwroutine = node->fdwroutine;
int plan_node_id = node->ss.ps.plan->plan_node_id;
void *coordinate;
- coordinate = shm_toc_lookup(toc, plan_node_id, false);
- fdwroutine->InitializeWorkerForeignScan(node, toc, coordinate);
+ coordinate = shm_toc_lookup(pwcxt->toc, plan_node_id, false);
+ fdwroutine->InitializeWorkerForeignScan(node, pwcxt->toc, coordinate);
}
}
* ----------------------------------------------------------------
*/
void
-ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node, shm_toc *toc)
+ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node,
+ ParallelWorkerContext *pwcxt)
{
ParallelIndexScanDesc piscan;
- piscan = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
+ piscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
node->ioss_ScanDesc =
index_beginscan_parallel(node->ss.ss_currentRelation,
node->ioss_RelationDesc,
* ----------------------------------------------------------------
*/
void
-ExecIndexScanInitializeWorker(IndexScanState *node, shm_toc *toc)
+ExecIndexScanInitializeWorker(IndexScanState *node,
+ ParallelWorkerContext *pwcxt)
{
ParallelIndexScanDesc piscan;
- piscan = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
+ piscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
node->iss_ScanDesc =
index_beginscan_parallel(node->ss.ss_currentRelation,
node->iss_RelationDesc,
* ----------------------------------------------------------------
*/
void
-ExecSeqScanInitializeWorker(SeqScanState *node, shm_toc *toc)
+ExecSeqScanInitializeWorker(SeqScanState *node,
+ ParallelWorkerContext *pwcxt)
{
ParallelHeapScanDesc pscan;
- pscan = shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, false);
+ pscan = shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, false);
node->ss.ss_currentScanDesc =
heap_beginscan_parallel(node->ss.ss_currentRelation, pscan);
}
* ----------------------------------------------------------------
*/
void
-ExecSortInitializeWorker(SortState *node, shm_toc *toc)
+ExecSortInitializeWorker(SortState *node, ParallelWorkerContext *pwcxt)
{
node->shared_info =
- shm_toc_lookup(toc, node->ss.ps.plan->plan_node_id, true);
+ shm_toc_lookup(pwcxt->toc, node->ss.ps.plan->plan_node_id, true);
node->am_worker = true;
}
ParallelWorkerInfo *worker;
} ParallelContext;
+typedef struct ParallelWorkerContext
+{
+ dsm_segment *seg;
+ shm_toc *toc;
+} ParallelWorkerContext;
+
extern volatile bool ParallelMessagePending;
extern int ParallelWorkerNumber;
extern bool InitializingParallelWorker;
extern void ExecBitmapHeapReInitializeDSM(BitmapHeapScanState *node,
ParallelContext *pcxt);
extern void ExecBitmapHeapInitializeWorker(BitmapHeapScanState *node,
- shm_toc *toc);
+ ParallelWorkerContext *pwcxt);
#endif /* NODEBITMAPHEAPSCAN_H */
extern void ExecCustomScanReInitializeDSM(CustomScanState *node,
ParallelContext *pcxt);
extern void ExecCustomScanInitializeWorker(CustomScanState *node,
- shm_toc *toc);
+ ParallelWorkerContext *pwcxt);
extern void ExecShutdownCustomScan(CustomScanState *node);
#endif /* NODECUSTOM_H */
extern void ExecForeignScanReInitializeDSM(ForeignScanState *node,
ParallelContext *pcxt);
extern void ExecForeignScanInitializeWorker(ForeignScanState *node,
- shm_toc *toc);
+ ParallelWorkerContext *pwcxt);
extern void ExecShutdownForeignScan(ForeignScanState *node);
#endif /* NODEFOREIGNSCAN_H */
extern void ExecIndexOnlyScanReInitializeDSM(IndexOnlyScanState *node,
ParallelContext *pcxt);
extern void ExecIndexOnlyScanInitializeWorker(IndexOnlyScanState *node,
- shm_toc *toc);
+ ParallelWorkerContext *pwcxt);
#endif /* NODEINDEXONLYSCAN_H */
extern void ExecIndexScanEstimate(IndexScanState *node, ParallelContext *pcxt);
extern void ExecIndexScanInitializeDSM(IndexScanState *node, ParallelContext *pcxt);
extern void ExecIndexScanReInitializeDSM(IndexScanState *node, ParallelContext *pcxt);
-extern void ExecIndexScanInitializeWorker(IndexScanState *node, shm_toc *toc);
+extern void ExecIndexScanInitializeWorker(IndexScanState *node,
+ ParallelWorkerContext *pwcxt);
/*
* These routines are exported to share code with nodeIndexonlyscan.c and
extern void ExecSeqScanEstimate(SeqScanState *node, ParallelContext *pcxt);
extern void ExecSeqScanInitializeDSM(SeqScanState *node, ParallelContext *pcxt);
extern void ExecSeqScanReInitializeDSM(SeqScanState *node, ParallelContext *pcxt);
-extern void ExecSeqScanInitializeWorker(SeqScanState *node, shm_toc *toc);
+extern void ExecSeqScanInitializeWorker(SeqScanState *node,
+ ParallelWorkerContext *pwcxt);
#endif /* NODESEQSCAN_H */
extern void ExecSortEstimate(SortState *node, ParallelContext *pcxt);
extern void ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt);
extern void ExecSortReInitializeDSM(SortState *node, ParallelContext *pcxt);
-extern void ExecSortInitializeWorker(SortState *node, shm_toc *toc);
+extern void ExecSortInitializeWorker(SortState *node, ParallelWorkerContext *pwcxt);
extern void ExecSortRetrieveInstrumentation(SortState *node);
#endif /* NODESORT_H */
ParallelIndexScanDesc
ParallelSlot
ParallelState
+ParallelWorkerContext
ParallelWorkerInfo
Param
ParamExecData