diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-04-13 21:33:59 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2011-04-13 22:05:40 +0300 |
commit | 54685b1c2b356b4b9c0938f6b8dcc52e173c0400 (patch) | |
tree | 38b2cbf31986e330052d8c652af7f5b7777843e4 /src/backend/access/transam/xlog.c | |
parent | b5bb040da63806f7386b3434c38e1fa98860ea88 (diff) | |
download | postgresql-54685b1c2b356b4b9c0938f6b8dcc52e173c0400.tar.gz postgresql-54685b1c2b356b4b9c0938f6b8dcc52e173c0400.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.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 9c45759661c..742d8551f6a 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6651,17 +6651,32 @@ 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"))); - /* ran off end of WAL */ - if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) - ereport(FATAL, - (errmsg("WAL ends before end of online backup"), - errhint("Online backup started with pg_start_backup() must be ended with pg_stop_backup(), and all WAL up to that point must be available at recovery."))); - else - ereport(FATAL, - (errmsg("WAL ends before consistent recovery point"))); + } + /* + * 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) + { + if (!XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) + ereport(FATAL, + (errmsg("WAL ends before end of online backup"), + errhint("Online backup started with pg_start_backup() must be ended with pg_stop_backup(), and all WAL up to that point must be available at recovery."))); + else + ereport(FATAL, + (errmsg("WAL ends before consistent recovery point"))); + } } /* @@ -8353,7 +8368,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"))); |