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

Function ExecSortInitializeDSM

src/backend/executor/nodeSort.c:529–546  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecSortInitializeDSM * * Initialize DSM space for sort statistics. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

527 * ----------------------------------------------------------------
528 */
529void
530ExecSortInitializeDSM(SortState *node, ParallelContext *pcxt)
531{
532 Size size;
533
534 /* don't need this if not instrumenting or no workers */
535 if (!node->ss.ps.instrument || pcxt->nworkers == 0)
536 return;
537
538 size = offsetof(SharedSortInfo, sinstrument)
539 + pcxt->nworkers * sizeof(TuplesortInstrumentation);
540 node->shared_info = shm_toc_allocate(pcxt->toc, size);
541 /* ensure any unfilled slots will contain zeroes */
542 memset(node->shared_info, 0, size);
543 node->shared_info->num_workers = pcxt->nworkers;
544 shm_toc_insert(pcxt->toc, node->ss.ps.plan->plan_node_id,
545 node->shared_info);
546}
547
548/* ----------------------------------------------------------------
549 * ExecSortInitializeWorker

Callers 2

Calls 2

shm_toc_allocateFunction · 0.85
shm_toc_insertFunction · 0.85

Tested by

no test coverage detected