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

Function CheckCopyStreamStop

src/bin/pg_basebackup/receivelog.c:1218–1238  ·  view source on GitHub ↗

* Check if we should continue streaming, or abort at this point. */

Source from the content-addressed store, hash-verified

1216 * Check if we should continue streaming, or abort at this point.
1217 */
1218static bool
1219CheckCopyStreamStop(PGconn *conn, StreamCtl *stream, XLogRecPtr blockpos)
1220{
1221 if (still_sending && stream->stream_stop(blockpos, stream->timeline, false))
1222 {
1223 if (!close_walfile(stream, blockpos))
1224 {
1225 /* Potential error message is written by close_walfile */
1226 return false;
1227 }
1228 if (PQputCopyEnd(conn, NULL) <= 0 || PQflush(conn))
1229 {
1230 pg_log_error("could not send copy-end packet: %s",
1231 PQerrorMessage(conn));
1232 return false;
1233 }
1234 still_sending = false;
1235 }
1236
1237 return true;
1238}
1239
1240/*
1241 * Calculate how long send/receive loops should sleep

Callers 1

HandleCopyStreamFunction · 0.85

Calls 4

close_walfileFunction · 0.85
PQputCopyEndFunction · 0.85
PQflushFunction · 0.85
PQerrorMessageFunction · 0.85

Tested by

no test coverage detected