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

Function mppExecutorCleanup

src/backend/executor/execUtils.c:2173–2217  ·  view source on GitHub ↗

* Cleanup the gp-specific parts of the query executor. * * Will normally be called after an error from within a CATCH block. */

Source from the content-addressed store, hash-verified

2171 * Will normally be called after an error from within a CATCH block.
2172 */
2173void mppExecutorCleanup(QueryDesc *queryDesc)
2174{
2175 CdbDispatcherState *ds;
2176 EState *estate;
2177
2178 /* caller must have switched into per-query memory context already */
2179 estate = queryDesc->estate;
2180 ds = estate->dispatcherState;
2181
2182 /* GPDB hook for collecting query info */
2183 if (query_info_collect_hook && QueryCancelCleanup)
2184 (*query_info_collect_hook)(METRICS_QUERY_CANCELING, queryDesc);
2185 /* Clean up the interconnect. */
2186 if (estate->es_interconnect_is_setup)
2187 {
2188 Assert(CurrentMotionIPCLayer);
2189 CurrentMotionIPCLayer->TeardownInterconnect(estate->interconnect_context, true);
2190 estate->es_interconnect_is_setup = false;
2191 }
2192
2193 /*
2194 * Request any commands still executing on qExecs to stop.
2195 * Wait for them to finish and clean up the dispatching structures.
2196 * Replace current error info with QE error info if more interesting.
2197 */
2198 if (ds)
2199 {
2200 estate->dispatcherState = NULL;
2201 CdbDispatchHandleError(ds);
2202 }
2203
2204 /* GPDB hook for collecting query info */
2205 if (query_info_collect_hook)
2206 (*query_info_collect_hook)(QueryCancelCleanup ? METRICS_QUERY_CANCELED : METRICS_QUERY_ERROR, queryDesc);
2207
2208 ReportOOMConsumption();
2209
2210 /**
2211 * Since there was an error, clean up the function scan stack.
2212 */
2213 if (!IsResManagerMemoryPolicyNone())
2214 {
2215 SPI_InitMemoryReservation();
2216 }
2217}
2218
2219/**
2220 * This method is used to determine how much memory a specific operator

Callers 8

PortalStartFunction · 0.85
PortalRunFunction · 0.85
PortalRunFetchFunction · 0.85
PersistHoldablePortalFunction · 0.85
DoCopyFunction · 0.85
standard_ExecutorStartFunction · 0.85
standard_ExecutorRunFunction · 0.85
standard_ExecutorEndFunction · 0.85

Calls 2

CdbDispatchHandleErrorFunction · 0.85

Tested by

no test coverage detected