---------------------------------------------------------------- * ExecAsyncAppendResponse * * Receive a response from an asynchronous request we made. * ---------------------------------------------------------------- */
| 1144 | * ---------------------------------------------------------------- |
| 1145 | */ |
| 1146 | void |
| 1147 | ExecAsyncAppendResponse(AsyncRequest *areq) |
| 1148 | { |
| 1149 | AppendState *node = (AppendState *) areq->requestor; |
| 1150 | TupleTableSlot *slot = areq->result; |
| 1151 | |
| 1152 | /* The result should be a TupleTableSlot or NULL. */ |
| 1153 | Assert(slot == NULL || IsA(slot, TupleTableSlot)); |
| 1154 | |
| 1155 | /* Nothing to do if the request is pending. */ |
| 1156 | if (!areq->request_complete) |
| 1157 | { |
| 1158 | /* The request would have been pending for a callback. */ |
| 1159 | Assert(areq->callback_pending); |
| 1160 | return; |
| 1161 | } |
| 1162 | |
| 1163 | /* If the result is NULL or an empty slot, there's nothing more to do. */ |
| 1164 | if (TupIsNull(slot)) |
| 1165 | { |
| 1166 | /* The ending subplan wouldn't have been pending for a callback. */ |
| 1167 | Assert(!areq->callback_pending); |
| 1168 | --node->as_nasyncremain; |
| 1169 | return; |
| 1170 | } |
| 1171 | |
| 1172 | /* Save result so we can return it. */ |
| 1173 | Assert(node->as_nasyncresults < node->as_nasyncplans); |
| 1174 | node->as_asyncresults[node->as_nasyncresults++] = slot; |
| 1175 | |
| 1176 | /* |
| 1177 | * Mark the subplan that returned a result as ready for a new request. We |
| 1178 | * don't launch another one here immediately because it might complete. |
| 1179 | */ |
| 1180 | node->as_needrequest = bms_add_member(node->as_needrequest, |
| 1181 | areq->request_index); |
| 1182 | } |
| 1183 | |
| 1184 | /* ---------------------------------------------------------------- |
| 1185 | * classify_matching_subplans |
no test coverage detected