Skip to content

Commit efc0c8c

Browse files
committed
bugfix: WAL delivery timeout could cause PostgreSQL instance to be left in in_backup state
1 parent 6d709fb commit efc0c8c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backup.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,12 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup)
10761076
2,
10771077
params);
10781078

1079+
/*
1080+
* Set flag that pg_start_backup() was called. If an error will happen it
1081+
* is necessary to call pg_stop_backup() in backup_cleanup().
1082+
*/
1083+
backup_in_progress = true;
1084+
10791085
/* Extract timeline and LSN from results of pg_start_backup() */
10801086
XLogDataFromLSN(PQgetvalue(res, 0, 0), &xlogid, &xrecoff);
10811087
/* Calculate LSN */
@@ -1108,12 +1114,6 @@ pg_start_backup(const char *label, bool smooth, pgBackup *backup)
11081114
/* Wait for start_lsn to be replayed by replica */
11091115
if (from_replica)
11101116
wait_replica_wal_lsn(backup->start_lsn, true);
1111-
1112-
/*
1113-
* Set flag that pg_start_backup() was called. If an error will happen it
1114-
* is necessary to call pg_stop_backup() in backup_cleanup().
1115-
*/
1116-
backup_in_progress = true;
11171117
}
11181118

11191119
/*

0 commit comments

Comments
 (0)