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

Function ExecAppendAsyncBegin

src/backend/executor/nodeAppend.c:901–948  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecAppendAsyncBegin * * Begin executing designed async-capable subplans. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

899 * ----------------------------------------------------------------
900 */
901static void
902ExecAppendAsyncBegin(AppendState *node)
903{
904 int i;
905
906 /* Backward scan is not supported by async-aware Appends. */
907 Assert(ScanDirectionIsForward(node->ps.state->es_direction));
908
909 /* We should never be called when there are no subplans */
910 Assert(node->as_nplans > 0);
911
912 /* We should never be called when there are no async subplans. */
913 Assert(node->as_nasyncplans > 0);
914
915 /* If we've yet to determine the valid subplans then do so now. */
916 if (node->as_valid_subplans == NULL)
917 {
918 Append *plan = (Append *) node->ps.plan;
919 node->as_valid_subplans =
920 ExecFindMatchingSubPlans(node->as_prune_state,
921 node->ps.state,
922 list_length(plan->appendplans),
923 plan->join_prune_paramids);
924
925 classify_matching_subplans(node);
926 }
927
928 /* Initialize state variables. */
929 node->as_syncdone = bms_is_empty(node->as_valid_subplans);
930 node->as_nasyncremain = bms_num_members(node->as_valid_asyncplans);
931
932 /* Nothing to do if there are no valid async subplans. */
933 if (node->as_nasyncremain == 0)
934 return;
935
936 /* Make a request for each of the valid async subplans. */
937 i = -1;
938 while ((i = bms_next_member(node->as_valid_asyncplans, i)) >= 0)
939 {
940 AsyncRequest *areq = node->as_asyncrequests[i];
941
942 Assert(areq->request_index == i);
943 Assert(!areq->callback_pending);
944
945 /* Do the actual work. */
946 ExecAsyncRequest(areq);
947 }
948}
949
950/* ----------------------------------------------------------------
951 * ExecAppendAsyncGetNext

Callers 1

ExecAppendFunction · 0.85

Calls 7

ExecFindMatchingSubPlansFunction · 0.85
list_lengthFunction · 0.85
bms_is_emptyFunction · 0.85
bms_num_membersFunction · 0.85
bms_next_memberFunction · 0.85
ExecAsyncRequestFunction · 0.85

Tested by

no test coverage detected