* Explain a parallel retrieve cursor, * indicate the endpoints exist on entry DB, or on some segments, * or on all segments. */
| 2306 | * or on all segments. |
| 2307 | */ |
| 2308 | void ExplainParallelRetrieveCursor(ExplainState *es, QueryDesc* queryDesc) |
| 2309 | { |
| 2310 | PlannedStmt *plan = queryDesc->plannedstmt; |
| 2311 | SliceTable *sliceTable = queryDesc->estate->es_sliceTable; |
| 2312 | StringInfoData endpointInfoStr; |
| 2313 | enum EndPointExecPosition endPointExecPosition; |
| 2314 | |
| 2315 | initStringInfo(&endpointInfoStr); |
| 2316 | |
| 2317 | endPointExecPosition = GetParallelCursorEndpointPosition(plan); |
| 2318 | ExplainOpenGroup("Cursor", "Cursor", true, es); |
| 2319 | switch(endPointExecPosition) |
| 2320 | { |
| 2321 | case ENDPOINT_ON_ENTRY_DB: |
| 2322 | { |
| 2323 | appendStringInfo(&endpointInfoStr, "\"on coordinator\""); |
| 2324 | break; |
| 2325 | } |
| 2326 | case ENDPOINT_ON_SINGLE_QE: |
| 2327 | { |
| 2328 | appendStringInfo( |
| 2329 | &endpointInfoStr, "\"on segment: contentid [%d]\"", |
| 2330 | gp_session_id % plan->planTree->flow->numsegments); |
| 2331 | break; |
| 2332 | } |
| 2333 | case ENDPOINT_ON_SOME_QE: |
| 2334 | { |
| 2335 | ListCell * cell; |
| 2336 | bool isFirst = true; |
| 2337 | appendStringInfo(&endpointInfoStr, "on segments: contentid ["); |
| 2338 | ExecSlice *slice = &sliceTable->slices[0]; |
| 2339 | foreach(cell, slice->segments) |
| 2340 | { |
| 2341 | int contentid = lfirst_int(cell); |
| 2342 | appendStringInfo(&endpointInfoStr, (isFirst)?"%d":", %d", contentid); |
| 2343 | isFirst = false; |
| 2344 | } |
| 2345 | appendStringInfo(&endpointInfoStr, "]"); |
| 2346 | break; |
| 2347 | } |
| 2348 | case ENDPOINT_ON_ALL_QE: |
| 2349 | { |
| 2350 | appendStringInfo(&endpointInfoStr, "on all %d segments", getgpsegmentCount()); |
| 2351 | break; |
| 2352 | } |
| 2353 | default: |
| 2354 | { |
| 2355 | elog(ERROR, "invalid endpoint position : %d", endPointExecPosition); |
| 2356 | break; |
| 2357 | } |
| 2358 | } |
| 2359 | ExplainPropertyText("Endpoint", endpointInfoStr.data, es); |
| 2360 | ExplainCloseGroup("Cursor", "Cursor", true, es); |
| 2361 | } |
no test coverage detected