Skip to content

Commit

Permalink
Handling exception to call the hook in standard_ExecutorStart
Browse files Browse the repository at this point in the history
Issue #12690, the code path in `standard_ExecutorStart` didn't handle
exception of `Policy*AssignOperatorMemoryKB`, which may cause the OOM
exception not handled in `standard_ExecutorStart` but throw to upper
`PortalStart` methods, in that case the hook needed by GPCC will not
be called. This commit fixed the issue.
  • Loading branch information
adam8157 committed Dec 20, 2022
1 parent 5b5e432 commit 5851198
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/backend/executor/execMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,10 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)

if (!should_skip_operator_memory_assign)
{
switch(*gp_resmanager_memory_policy)
PG_TRY();
{
switch (*gp_resmanager_memory_policy)
{
case RESMANAGER_MEMORY_POLICY_AUTO:
PolicyAutoAssignOperatorMemoryKB(queryDesc->plannedstmt,
queryDesc->plannedstmt->query_mem);
Expand All @@ -397,7 +399,17 @@ standard_ExecutorStart(QueryDesc *queryDesc, int eflags)
default:
Assert(IsResManagerMemoryPolicyNone());
break;
}
}
PG_CATCH();
{
/* GPDB hook for collecting query info */
if (query_info_collect_hook)
(*query_info_collect_hook)(QueryCancelCleanup ? METRICS_QUERY_CANCELED : METRICS_QUERY_ERROR, queryDesc);

PG_RE_THROW();
}
PG_END_TRY();
}
}

Expand Down

0 comments on commit 5851198

Please sign in to comment.