Skip to content

Commit 62eee9c

Browse files
committed
Write ERROR status of the backup before executing pg_stop_backup()
1 parent 2654810 commit 62eee9c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

backup.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,14 +1006,6 @@ backup_cleanup(bool fatal, void *userdata)
10061006
{
10071007
char path[MAXPGPATH];
10081008

1009-
/* If backup_label exists in $PGDATA, notify stop of backup to PostgreSQL */
1010-
join_path_components(path, pgdata, PG_BACKUP_LABEL_FILE);
1011-
if (fileExists(path))
1012-
{
1013-
elog(LOG, "%s exists, stop backup", PG_BACKUP_LABEL_FILE);
1014-
pg_stop_backup(NULL); /* don't care stop_lsn on error case */
1015-
}
1016-
10171009
/*
10181010
* Update status of backup in BACKUP_CONTROL_FILE to ERROR.
10191011
* end_time != 0 means backup finished
@@ -1025,6 +1017,17 @@ backup_cleanup(bool fatal, void *userdata)
10251017
current.status = BACKUP_STATUS_ERROR;
10261018
pgBackupWriteBackupControlFile(&current);
10271019
}
1020+
1021+
/*
1022+
* If backup_label exists in $PGDATA, notify stop of backup to PostgreSQL
1023+
* TODO Do we need this?
1024+
*/
1025+
join_path_components(path, pgdata, PG_BACKUP_LABEL_FILE);
1026+
if (fileExists(path))
1027+
{
1028+
elog(LOG, "%s exists, stop backup", PG_BACKUP_LABEL_FILE);
1029+
pg_stop_backup(NULL); /* don't care stop_lsn on error case */
1030+
}
10281031
}
10291032

10301033
/*

0 commit comments

Comments
 (0)