aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-13 21:33:59 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-04-13 22:00:43 +0300
commit083cc494228c55f38d2fcc9ec19c957eff7adb00 (patch)
tree95121003e8f3ce74922f12d9ac5d8f43c3d268fb
parent052e621cc2c25166037fe9fadd3082ae70045fec (diff)
downloadpostgresql-083cc494228c55f38d2fcc9ec19c957eff7adb00.tar.gz
postgresql-083cc494228c55f38d2fcc9ec19c957eff7adb00.zip
Revert the patch to check if we've reached end-of-backup also when doing
crash recovery, and throw an error if not. hubert depesz lubaczewski pointed out that that situation also happens in the crash recovery following a system crash that happens during an online backup. We might want to do something smarter in 9.1, like put the check back for backups taken with pg_basebackup, but that's for another patch.
-rw-r--r--src/backend/access/transam/xlog.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index eac61c5727c..56f32f6ed8d 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6322,12 +6322,28 @@ StartupXLOG(void)
(XLByteLT(EndOfLog, minRecoveryPoint) ||
!XLogRecPtrIsInvalid(ControlFile->backupStartPoint)))
{
- if (reachedStopPoint) /* stopped because of stop request */
+ if (reachedStopPoint)
+ {
+ /* stopped because of stop request */
ereport(FATAL,
(errmsg("requested recovery stop point is before consistent recovery point")));
- else /* ran off end of WAL */
- ereport(FATAL,
- (errmsg("WAL ends before consistent recovery point")));
+ }
+ else
+ {
+ /*
+ * Ran off end of WAL before reaching end-of-backup WAL record,
+ * or minRecoveryPoint. That's usually a bad sign, indicating that
+ * you tried to recover from an online backup but never called
+ * pg_stop_backup(), or you didn't archive all the WAL up to that
+ * point. However, this also happens in crash recovery, if the
+ * system crashes while an online backup is in progress. We
+ * must not treat that as an error, or the database will refuse
+ * to start up.
+ */
+ if (InArchiveRecovery)
+ ereport(FATAL,
+ (errmsg("WAL ends before consistent recovery point")));
+ }
}
/*
@@ -7910,7 +7926,8 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
* record, the backup was cancelled and the end-of-backup record will
* never arrive.
*/
- if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
+ if (InArchiveRecovery &&
+ !XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
ereport(ERROR,
(errmsg("online backup was cancelled, recovery cannot continue")));