Skip to content

Commit eff9335

Browse files
committed
Check that we've reached end-of-backup also when we're not performing
archive recovery. It's possible to restore an online backup without recovery.conf, by simply copying all the necessary WAL files to pg_xlog. "pg_basebackup -x" does that too. That's the use case where this cross-check is useful. Backpatch to 9.0. We used to do this in earlier versins, but in 9.0 the code was inadvertently changed so that the check is only performed after archive recovery. Fujii Masao.
1 parent ce3b0ab commit eff9335

File tree

1 file changed

+3
-5
lines changed
  • src/backend/access/transam

1 file changed

+3
-5
lines changed

src/backend/access/transam/xlog.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5997,8 +5997,7 @@ StartupXLOG(void)
59975997
}
59985998

59995999
/*
6000-
* set backupStartupPoint if we're starting archive recovery from a
6001-
* base backup
6000+
* set backupStartPoint if we're starting recovery from a base backup
60026001
*/
60036002
if (haveBackupLabel)
60046003
ControlFile->backupStartPoint = checkPoint.redo;
@@ -6319,7 +6318,7 @@ StartupXLOG(void)
63196318
* be further ahead --- ControlFile->minRecoveryPoint cannot have been
63206319
* advanced beyond the WAL we processed.
63216320
*/
6322-
if (InArchiveRecovery &&
6321+
if (InRecovery &&
63236322
(XLByteLT(EndOfLog, minRecoveryPoint) ||
63246323
!XLogRecPtrIsInvalid(ControlFile->backupStartPoint)))
63256324
{
@@ -7911,8 +7910,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
79117910
* record, the backup was cancelled and the end-of-backup record will
79127911
* never arrive.
79137912
*/
7914-
if (InArchiveRecovery &&
7915-
!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
7913+
if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
79167914
ereport(ERROR,
79177915
(errmsg("online backup was cancelled, recovery cannot continue")));
79187916

0 commit comments

Comments
 (0)