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

Function tqueueReceiveSlot

src/backend/executor/tqueue.c:53–77  ·  view source on GitHub ↗

* Receive a tuple from a query, and send it to the designated shm_mq. * * Returns true if successful, false if shm_mq has been detached. */

Source from the content-addressed store, hash-verified

51 * Returns true if successful, false if shm_mq has been detached.
52 */
53static bool
54tqueueReceiveSlot(TupleTableSlot *slot, DestReceiver *self)
55{
56 TQueueDestReceiver *tqueue = (TQueueDestReceiver *) self;
57 MinimalTuple tuple;
58 shm_mq_result result;
59 bool should_free;
60
61 /* Send the tuple itself. */
62 tuple = ExecFetchSlotMinimalTuple(slot, &should_free);
63 result = shm_mq_send(tqueue->queue, tuple->t_len, tuple, false);
64
65 if (should_free)
66 pfree(tuple);
67
68 /* Check for failure. */
69 if (result == SHM_MQ_DETACHED)
70 return false;
71 else if (result != SHM_MQ_SUCCESS && result != SHM_MQ_QUERY_FINISH)
72 ereport(ERROR,
73 (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
74 errmsg("could not send tuple to shared-memory queue")));
75
76 return true;
77}
78
79/*
80 * Prepare to receive tuples from executor.

Callers

nothing calls this directly

Calls 5

shm_mq_sendFunction · 0.85
pfreeFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected