---------------------------------------------------------------- * ExecAppendAsyncGetNext * * Get the next tuple from any of the asynchronous subplans. * ---------------------------------------------------------------- */
| 954 | * ---------------------------------------------------------------- |
| 955 | */ |
| 956 | static bool |
| 957 | ExecAppendAsyncGetNext(AppendState *node, TupleTableSlot **result) |
| 958 | { |
| 959 | *result = NULL; |
| 960 | |
| 961 | /* We should never be called when there are no valid async subplans. */ |
| 962 | Assert(node->as_nasyncremain > 0); |
| 963 | |
| 964 | /* Request a tuple asynchronously. */ |
| 965 | if (ExecAppendAsyncRequest(node, result)) |
| 966 | return true; |
| 967 | |
| 968 | while (node->as_nasyncremain > 0) |
| 969 | { |
| 970 | CHECK_FOR_INTERRUPTS(); |
| 971 | |
| 972 | /* Wait or poll for async events. */ |
| 973 | ExecAppendAsyncEventWait(node); |
| 974 | |
| 975 | /* Request a tuple asynchronously. */ |
| 976 | if (ExecAppendAsyncRequest(node, result)) |
| 977 | return true; |
| 978 | |
| 979 | /* Break from loop if there's any sync subplan that isn't complete. */ |
| 980 | if (!node->as_syncdone) |
| 981 | break; |
| 982 | } |
| 983 | |
| 984 | /* |
| 985 | * If all sync subplans are complete, we're totally done scanning the |
| 986 | * given node. Otherwise, we're done with the asynchronous stuff but must |
| 987 | * continue scanning the sync subplans. |
| 988 | */ |
| 989 | if (node->as_syncdone) |
| 990 | { |
| 991 | Assert(node->as_nasyncremain == 0); |
| 992 | *result = ExecClearTuple(node->ps.ps_ResultTupleSlot); |
| 993 | return true; |
| 994 | } |
| 995 | |
| 996 | return false; |
| 997 | } |
| 998 | |
| 999 | /* ---------------------------------------------------------------- |
| 1000 | * ExecAppendAsyncRequest |
no test coverage detected