Check that we've reached end-of-backup also when we're not performing
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 30 Mar 2011 07:36:58 +0000 (10:36 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 30 Mar 2011 07:53:47 +0000 (10:53 +0300)
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.

src/backend/access/transam/xlog.c

index 4e4ec1cb9a82d2496daf7eb8eb96b010fe6a6d3b..eac61c5727c2373f05b8505ac8b39c1c6636407c 100644 (file)
@@ -5997,8 +5997,7 @@ StartupXLOG(void)
                }
 
                /*
-                * set backupStartupPoint if we're starting archive recovery from a
-                * base backup
+                * set backupStartPoint if we're starting recovery from a base backup
                 */
                if (haveBackupLabel)
                        ControlFile->backupStartPoint = checkPoint.redo;
@@ -6319,7 +6318,7 @@ StartupXLOG(void)
         * be further ahead --- ControlFile->minRecoveryPoint cannot have been
         * advanced beyond the WAL we processed.
         */
-       if (InArchiveRecovery &&
+       if (InRecovery &&
                (XLByteLT(EndOfLog, minRecoveryPoint) ||
                 !XLogRecPtrIsInvalid(ControlFile->backupStartPoint)))
        {
@@ -7911,8 +7910,7 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
                 * record, the backup was cancelled and the end-of-backup record will
                 * never arrive.
                 */
-               if (InArchiveRecovery &&
-                       !XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
+               if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
                        ereport(ERROR,
                                        (errmsg("online backup was cancelled, recovery cannot continue")));