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

Function standard_ExecutorStart

src/backend/executor/execMain.c:245–786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245void
246standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
247{
248 EState *estate;
249 MemoryContext oldcontext;
250 GpExecIdentity exec_identity;
251 bool shouldDispatch;
252 bool needDtx;
253 List *volatile toplevelOidCache = NIL;
254
255 /* sanity checks: queryDesc must not be started already */
256 Assert(queryDesc != NULL);
257 Assert(queryDesc->estate == NULL);
258 Assert(queryDesc->plannedstmt != NULL);
259
260 Assert(queryDesc->plannedstmt->intoPolicy == NULL ||
261 GpPolicyIsPartitioned(queryDesc->plannedstmt->intoPolicy) ||
262 GpPolicyIsReplicated(queryDesc->plannedstmt->intoPolicy));
263
264 /* GPDB hook for collecting query info */
265 if (query_info_collect_hook)
266 (*query_info_collect_hook)(METRICS_QUERY_START, queryDesc);
267
268 if (Gp_role == GP_ROLE_DISPATCH)
269 {
270 if (!IsResManagerMemoryPolicyNone() &&
271 LogResManagerMemory())
272 {
273 elog(GP_RESMANAGER_MEMORY_LOG_LEVEL, "query requested %.0fKB of memory",
274 (double) queryDesc->plannedstmt->query_mem / 1024.0);
275 }
276
277 if (queryDesc->plannedstmt->query_mem > 0)
278 {
279 PG_TRY();
280 {
281 switch (*gp_resmanager_memory_policy)
282 {
283 case RESMANAGER_MEMORY_POLICY_AUTO:
284 PolicyAutoAssignOperatorMemoryKB(queryDesc->plannedstmt,
285 queryDesc->plannedstmt->query_mem);
286 break;
287 case RESMANAGER_MEMORY_POLICY_EAGER_FREE:
288 PolicyEagerFreeAssignOperatorMemoryKB(queryDesc->plannedstmt,
289 queryDesc->plannedstmt->query_mem);
290 break;
291 default:
292 Assert(IsResManagerMemoryPolicyNone());
293 break;
294 }
295 }
296 PG_CATCH();
297 {
298 /* GPDB hook for collecting query info */
299 if (query_info_collect_hook)
300 (*query_info_collect_hook)(QueryCancelCleanup ? METRICS_QUERY_CANCELED : METRICS_QUERY_ERROR, queryDesc);
301
302 PG_RE_THROW();

Callers 3

pgss_ExecutorStartFunction · 0.85
explain_ExecutorStartFunction · 0.85
ExecutorStartFunction · 0.85

Calls 15

GpPolicyIsPartitionedFunction · 0.85
GpPolicyIsReplicatedFunction · 0.85
IsInParallelModeFunction · 0.85
ExecCheckXactReadOnlyFunction · 0.85
CreateExecutorStateFunction · 0.85
MemoryContextSwitchToFunction · 0.85
list_lengthFunction · 0.85
create_queryEnvFunction · 0.85
AddPreassignedENRFunction · 0.85
GetCurrentCommandIdFunction · 0.85
RegisterSnapshotFunction · 0.85
InitSliceTableFunction · 0.85

Tested by

no test coverage detected