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

Function process_pending_request

contrib/postgres_fdw/postgres_fdw.c:7180–7208  ·  view source on GitHub ↗

* Process a pending asynchronous request. */

Source from the content-addressed store, hash-verified

7178 * Process a pending asynchronous request.
7179 */
7180void
7181process_pending_request(AsyncRequest *areq)
7182{
7183 ForeignScanState *node = (ForeignScanState *) areq->requestee;
7184 PgFdwScanState *fsstate PG_USED_FOR_ASSERTS_ONLY = (PgFdwScanState *) node->fdw_state;
7185
7186 /* The request would have been pending for a callback */
7187 Assert(areq->callback_pending);
7188
7189 /* The request should be currently in-process */
7190 Assert(fsstate->conn_state->pendingAreq == areq);
7191
7192 fetch_more_data(node);
7193
7194 /*
7195 * If we didn't get any tuples, must be end of data; complete the request
7196 * now. Otherwise, we postpone completing the request until we are called
7197 * from postgresForeignAsyncConfigureWait()/postgresForeignAsyncNotify().
7198 */
7199 if (fsstate->next_tuple >= fsstate->num_tuples)
7200 {
7201 /* Unlike AsyncNotify, we unset callback_pending ourselves */
7202 areq->callback_pending = false;
7203 /* Mark the request as complete */
7204 ExecAsyncRequestDone(areq, NULL);
7205 /* Unlike AsyncNotify, we call ExecAsyncResponse ourselves */
7206 ExecAsyncResponse(areq);
7207 }
7208}
7209
7210/*
7211 * Complete a pending asynchronous request.

Callers 6

GetConnectionFunction · 0.85
pgfdw_exec_queryFunction · 0.85
create_cursorFunction · 0.85
execute_foreign_modifyFunction · 0.85
execute_dml_stmtFunction · 0.85

Calls 3

fetch_more_dataFunction · 0.85
ExecAsyncRequestDoneFunction · 0.85
ExecAsyncResponseFunction · 0.85

Tested by

no test coverage detected