1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2025-07-14 06:54:15 +02:00

minor bugfix: in asynchronous execution of pg_stop_backup() was small risk of ignoring server side error. Reported by Alex Ignatov alexign@ozon.ru

This commit is contained in:
Grigory Smolkin
2019-07-15 15:11:04 +03:00
parent 9af4c7be9b
commit a466eea901

View File

@ -1689,7 +1689,11 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn)
while (1) while (1)
{ {
if (!PQconsumeInput(conn) || PQisBusy(conn)) if (!PQconsumeInput(conn))
elog(ERROR, "pg_stop backup() failed: %s",
PQerrorMessage(conn));
if (PQisBusy(conn))
{ {
pg_stop_backup_timeout++; pg_stop_backup_timeout++;
sleep(1); sleep(1);
@ -1755,6 +1759,9 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn)
char *xlog_path, char *xlog_path,
stream_xlog_path[MAXPGPATH]; stream_xlog_path[MAXPGPATH];
elog(WARNING, "Invalid stop_backup_lsn value %X/%X",
(uint32) (stop_backup_lsn >> 32), (uint32) (stop_backup_lsn));
if (stream_wal) if (stream_wal)
{ {
pgBackupGetPath2(backup, stream_xlog_path, pgBackupGetPath2(backup, stream_xlog_path,
@ -1885,10 +1892,6 @@ pg_stop_backup(pgBackup *backup, PGconn *pg_startbackup_conn)
char *xlog_path, char *xlog_path,
stream_xlog_path[MAXPGPATH]; stream_xlog_path[MAXPGPATH];
/* Wait for stop_lsn to be received by replica */
/* XXX Do we need this? */
// if (current.from_replica)
// wait_replica_wal_lsn(stop_backup_lsn, false);
/* /*
* Wait for stop_lsn to be archived or streamed. * Wait for stop_lsn to be archived or streamed.
* We wait for stop_lsn in stream mode just in case. * We wait for stop_lsn in stream mode just in case.