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

Function ExecHashInitializeDSM

src/backend/executor/nodeHash.c:3305–3324  ·  view source on GitHub ↗

* Set up a space in the DSM for all workers to record instrumentation data * about their hash table. */

Source from the content-addressed store, hash-verified

3303 * about their hash table.
3304 */
3305void
3306ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt)
3307{
3308 size_t size;
3309
3310 /* don't need this if not instrumenting or no workers */
3311 if (!node->ps.instrument || pcxt->nworkers == 0)
3312 return;
3313
3314 size = offsetof(SharedHashInfo, hinstrument) +
3315 pcxt->nworkers * sizeof(HashInstrumentation);
3316 node->shared_info = (SharedHashInfo *) shm_toc_allocate(pcxt->toc, size);
3317
3318 /* Each per-worker area must start out as zeroes. */
3319 memset(node->shared_info, 0, size);
3320
3321 node->shared_info->num_workers = pcxt->nworkers;
3322 shm_toc_insert(pcxt->toc, node->ps.plan->plan_node_id,
3323 node->shared_info);
3324}
3325
3326/*
3327 * Locate the DSM space for hash table instrumentation data that we'll write

Callers 2

Calls 2

shm_toc_allocateFunction · 0.85
shm_toc_insertFunction · 0.85

Tested by

no test coverage detected