| 243 | } |
| 244 | |
| 245 | void |
| 246 | standard_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(); |
no test coverage detected