* Check if we should continue streaming, or abort at this point. */
| 1216 | * Check if we should continue streaming, or abort at this point. |
| 1217 | */ |
| 1218 | static bool |
| 1219 | CheckCopyStreamStop(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 |
no test coverage detected