PostgreSQL Source Code  git master
execAsync.c File Reference
Include dependency graph for execAsync.c:

Go to the source code of this file.

Functions

void ExecAsyncRequest (AsyncRequest *areq)
 
void ExecAsyncConfigureWait (AsyncRequest *areq)
 
void ExecAsyncNotify (AsyncRequest *areq)
 
void ExecAsyncResponse (AsyncRequest *areq)
 
void ExecAsyncRequestDone (AsyncRequest *areq, TupleTableSlot *result)
 
void ExecAsyncRequestPending (AsyncRequest *areq)
 

Function Documentation

◆ ExecAsyncConfigureWait()

void ExecAsyncConfigureWait ( AsyncRequest areq)

Definition at line 62 of file execAsync.c.

References elog, ERROR, ExecAsyncForeignScanConfigureWait(), InstrStartNode(), InstrStopNode(), PlanState::instrument, nodeTag, AsyncRequest::requestee, and T_ForeignScanState.

Referenced by ExecAppendAsyncEventWait().

63 {
64  /* must provide our own instrumentation support */
65  if (areq->requestee->instrument)
67 
68  switch (nodeTag(areq->requestee))
69  {
70  case T_ForeignScanState:
72  break;
73  default:
74  /* If the node doesn't support async, caller messed up. */
75  elog(ERROR, "unrecognized node type: %d",
76  (int) nodeTag(areq->requestee));
77  }
78 
79  /* must provide our own instrumentation support */
80  if (areq->requestee->instrument)
81  InstrStopNode(areq->requestee->instrument, 0.0);
82 }
void InstrStopNode(Instrumentation *instr, double nTuples)
Definition: instrument.c:84
void ExecAsyncForeignScanConfigureWait(AsyncRequest *areq)
Instrumentation * instrument
Definition: execnodes.h:976
#define ERROR
Definition: elog.h:46
struct PlanState * requestee
Definition: execnodes.h:538
void InstrStartNode(Instrumentation *instr)
Definition: instrument.c:68
#define nodeTag(nodeptr)
Definition: nodes.h:541
#define elog(elevel,...)
Definition: elog.h:232

◆ ExecAsyncNotify()

void ExecAsyncNotify ( AsyncRequest areq)

Definition at line 88 of file execAsync.c.

References elog, ERROR, ExecAsyncForeignScanNotify(), ExecAsyncResponse(), InstrStartNode(), InstrStopNode(), PlanState::instrument, nodeTag, AsyncRequest::requestee, AsyncRequest::result, T_ForeignScanState, and TupIsNull.

Referenced by ExecAppendAsyncEventWait().

89 {
90  /* must provide our own instrumentation support */
91  if (areq->requestee->instrument)
93 
94  switch (nodeTag(areq->requestee))
95  {
96  case T_ForeignScanState:
98  break;
99  default:
100  /* If the node doesn't support async, caller messed up. */
101  elog(ERROR, "unrecognized node type: %d",
102  (int) nodeTag(areq->requestee));
103  }
104 
105  ExecAsyncResponse(areq);
106 
107  /* must provide our own instrumentation support */
108  if (areq->requestee->instrument)
110  TupIsNull(areq->result) ? 0.0 : 1.0);
111 }
void InstrStopNode(Instrumentation *instr, double nTuples)
Definition: instrument.c:84
Instrumentation * instrument
Definition: execnodes.h:976
void ExecAsyncForeignScanNotify(AsyncRequest *areq)
#define ERROR
Definition: elog.h:46
struct PlanState * requestee
Definition: execnodes.h:538
void InstrStartNode(Instrumentation *instr)
Definition: instrument.c:68
#define TupIsNull(slot)
Definition: tuptable.h:292
TupleTableSlot * result
Definition: execnodes.h:542
void ExecAsyncResponse(AsyncRequest *areq)
Definition: execAsync.c:117
#define nodeTag(nodeptr)
Definition: nodes.h:541
#define elog(elevel,...)
Definition: elog.h:232

◆ ExecAsyncRequest()

void ExecAsyncRequest ( AsyncRequest areq)

Definition at line 26 of file execAsync.c.

References PlanState::chgParam, elog, ERROR, ExecAsyncForeignScanRequest(), ExecAsyncResponse(), ExecReScan(), InstrStartNode(), InstrStopNode(), PlanState::instrument, nodeTag, AsyncRequest::requestee, AsyncRequest::result, T_ForeignScanState, and TupIsNull.

Referenced by ExecAppendAsyncBegin(), and ExecAppendAsyncRequest().

27 {
28  if (areq->requestee->chgParam != NULL) /* something changed? */
29  ExecReScan(areq->requestee); /* let ReScan handle this */
30 
31  /* must provide our own instrumentation support */
32  if (areq->requestee->instrument)
34 
35  switch (nodeTag(areq->requestee))
36  {
37  case T_ForeignScanState:
39  break;
40  default:
41  /* If the node doesn't support async, caller messed up. */
42  elog(ERROR, "unrecognized node type: %d",
43  (int) nodeTag(areq->requestee));
44  }
45 
46  ExecAsyncResponse(areq);
47 
48  /* must provide our own instrumentation support */
49  if (areq->requestee->instrument)
51  TupIsNull(areq->result) ? 0.0 : 1.0);
52 }
void InstrStopNode(Instrumentation *instr, double nTuples)
Definition: instrument.c:84
Instrumentation * instrument
Definition: execnodes.h:976
void ExecReScan(PlanState *node)
Definition: execAmi.c:78
#define ERROR
Definition: elog.h:46
struct PlanState * requestee
Definition: execnodes.h:538
void InstrStartNode(Instrumentation *instr)
Definition: instrument.c:68
#define TupIsNull(slot)
Definition: tuptable.h:292
Bitmapset * chgParam
Definition: execnodes.h:998
TupleTableSlot * result
Definition: execnodes.h:542
void ExecAsyncForeignScanRequest(AsyncRequest *areq)
void ExecAsyncResponse(AsyncRequest *areq)
Definition: execAsync.c:117
#define nodeTag(nodeptr)
Definition: nodes.h:541
#define elog(elevel,...)
Definition: elog.h:232

◆ ExecAsyncRequestDone()

void ExecAsyncRequestDone ( AsyncRequest areq,
TupleTableSlot result 
)

Definition at line 137 of file execAsync.c.

References AsyncRequest::request_complete, and AsyncRequest::result.

Referenced by process_pending_request(), and produce_tuple_asynchronously().

138 {
139  areq->request_complete = true;
140  areq->result = result;
141 }
TupleTableSlot * result
Definition: execnodes.h:542
bool request_complete
Definition: execnodes.h:541

◆ ExecAsyncRequestPending()

void ExecAsyncRequestPending ( AsyncRequest areq)

Definition at line 149 of file execAsync.c.

References AsyncRequest::callback_pending, AsyncRequest::request_complete, and AsyncRequest::result.

Referenced by produce_tuple_asynchronously().

150 {
151  areq->callback_pending = true;
152  areq->request_complete = false;
153  areq->result = NULL;
154 }
TupleTableSlot * result
Definition: execnodes.h:542
bool callback_pending
Definition: execnodes.h:540
bool request_complete
Definition: execnodes.h:541

◆ ExecAsyncResponse()

void ExecAsyncResponse ( AsyncRequest areq)

Definition at line 117 of file execAsync.c.

References elog, ERROR, ExecAsyncAppendResponse(), nodeTag, AsyncRequest::requestor, and T_AppendState.

Referenced by complete_pending_request(), ExecAsyncNotify(), ExecAsyncRequest(), and process_pending_request().

118 {
119  switch (nodeTag(areq->requestor))
120  {
121  case T_AppendState:
123  break;
124  default:
125  /* If the node doesn't support async, caller messed up. */
126  elog(ERROR, "unrecognized node type: %d",
127  (int) nodeTag(areq->requestor));
128  }
129 }
struct PlanState * requestor
Definition: execnodes.h:537
#define ERROR
Definition: elog.h:46
void ExecAsyncAppendResponse(AsyncRequest *areq)
Definition: nodeAppend.c:1108
#define nodeTag(nodeptr)
Definition: nodes.h:541
#define elog(elevel,...)
Definition: elog.h:232