MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecParallelInitializeDSM

Function ExecParallelInitializeDSM

src/backend/executor/execParallel.c:441–532  ·  view source on GitHub ↗

* Initialize the dynamic shared memory segment that will be used to control * parallel execution. */

Source from the content-addressed store, hash-verified

439 * parallel execution.
440 */
441static bool
442ExecParallelInitializeDSM(PlanState *planstate,
443 ExecParallelInitializeDSMContext *d)
444{
445 if (planstate == NULL)
446 return false;
447
448 /* If instrumentation is enabled, initialize slot for this node. */
449 if (d->instrumentation != NULL)
450 d->instrumentation->plan_node_id[d->nnodes] =
451 planstate->plan->plan_node_id;
452
453 /* Count this node. */
454 d->nnodes++;
455
456 /*
457 * Call initializers for DSM-using plan nodes.
458 *
459 * Most plan nodes won't do anything here, but plan nodes that allocated
460 * DSM may need to initialize shared state in the DSM before parallel
461 * workers are launched. They can allocate the space they previously
462 * estimated using shm_toc_allocate, and add the keys they previously
463 * estimated using shm_toc_insert, in each case targeting pcxt->toc.
464 */
465 switch (nodeTag(planstate))
466 {
467 case T_SeqScanState:
468 if (planstate->plan->parallel_aware)
469 ExecSeqScanInitializeDSM((SeqScanState *) planstate,
470 d->pcxt);
471 break;
472 case T_IndexScanState:
473 if (planstate->plan->parallel_aware)
474 ExecIndexScanInitializeDSM((IndexScanState *) planstate,
475 d->pcxt);
476 break;
477 case T_IndexOnlyScanState:
478 if (planstate->plan->parallel_aware)
479 ExecIndexOnlyScanInitializeDSM((IndexOnlyScanState *) planstate,
480 d->pcxt);
481 break;
482 case T_ForeignScanState:
483 if (planstate->plan->parallel_aware)
484 ExecForeignScanInitializeDSM((ForeignScanState *) planstate,
485 d->pcxt);
486 break;
487 case T_AppendState:
488 if (planstate->plan->parallel_aware)
489 ExecAppendInitializeDSM((AppendState *) planstate,
490 d->pcxt);
491 break;
492 case T_CustomScanState:
493 if (planstate->plan->parallel_aware)
494 ExecCustomScanInitializeDSM((CustomScanState *) planstate,
495 d->pcxt);
496 break;
497 case T_BitmapHeapScanState:
498 if (planstate->plan->parallel_aware)

Callers 1

ExecInitParallelPlanFunction · 0.85

Tested by

no test coverage detected