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

Function ExplainCreateWorkersState

src/backend/commands/explain.c:5222–5234  ·  view source on GitHub ↗

* Create a per-plan-node workspace for collecting per-worker data. * * Output related to each worker will be temporarily "set aside" into a * separate buffer, which we'll merge into the main output stream once * we've processed all data for the plan node. This makes it feasible to * generate a coherent sub-group of fields for each worker, even though the * code that produces the fields is i

Source from the content-addressed store, hash-verified

5220 * ExplainOpenSetAsideGroup and ExplainSaveGroup/ExplainRestoreGroup.
5221 */
5222static ExplainWorkersState *
5223ExplainCreateWorkersState(int num_workers)
5224{
5225 ExplainWorkersState *wstate;
5226
5227 wstate = (ExplainWorkersState *) palloc(sizeof(ExplainWorkersState));
5228 wstate->num_workers = num_workers;
5229 wstate->worker_inited = (bool *) palloc0(num_workers * sizeof(bool));
5230 wstate->worker_str = (StringInfoData *)
5231 palloc0(num_workers * sizeof(StringInfoData));
5232 wstate->worker_state_save = (int *) palloc(num_workers * sizeof(int));
5233 return wstate;
5234}
5235
5236/*
5237 * Begin or resume output into the set-aside group for worker N.

Callers 1

ExplainNodeFunction · 0.85

Calls 2

pallocFunction · 0.50
palloc0Function · 0.50

Tested by

no test coverage detected