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

Function cdbCopySendData

src/backend/cdb/cdbcopy.c:241–277  ·  view source on GitHub ↗

* sends data to a copy command on a specific segment (usually * the hash result of the data value). */

Source from the content-addressed store, hash-verified

239 * the hash result of the data value).
240 */
241void
242cdbCopySendData(CdbCopy *c, int target_seg, const char *buffer,
243 int nbytes)
244{
245 SegmentDatabaseDescriptor *q;
246 Gang *gp;
247 int result;
248
249 /*
250 * NOTE!! note that another DELIM was added, for the buf_converted in the
251 * code above. I didn't do it because it's broken right now
252 */
253
254 gp = getCdbCopyPrimaryGang(c);
255 Assert(gp);
256 q = getSegmentDescriptorFromGang(gp, target_seg);
257
258 /* transmit the COPY data */
259 result = PQputCopyData(q->conn, buffer, nbytes);
260
261 if (result != 1)
262 {
263 if (result == 0)
264 {
265 /* We don't use blocking mode, so this shouldn't happen */
266 ereport(ERROR,
267 (errcode(ERRCODE_IO_ERROR),
268 errmsg("could not send COPY data to segment %d, attempt blocked",
269 target_seg)));
270 }
271 else
272 ereport(ERROR,
273 (errcode(ERRCODE_IO_ERROR),
274 errmsg("could not send COPY data to segment %d: %s",
275 target_seg, PQerrorMessage(q->conn))));
276 }
277}
278
279/*
280 * gets a chunk of rows of data from a copy command.

Callers 4

CopyFromDirectoryTableFunction · 0.85
cdbCopySendDataToAllFunction · 0.85

Calls 6

getCdbCopyPrimaryGangFunction · 0.85
PQputCopyDataFunction · 0.85
PQerrorMessageFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected