diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-04-27 09:25:18 +0000 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2010-04-27 09:25:18 +0000 |
commit | 3efba16d569ef00f8db20eb7c1f3ac80140e5902 (patch) | |
tree | 246d388ebad62b1f5834474936348b134b43ecc3 /src/backend/access/transam/xlog.c | |
parent | 3456cf1831feacd066037856cba044cce3935e54 (diff) | |
download | postgresql-3efba16d569ef00f8db20eb7c1f3ac80140e5902.tar.gz postgresql-3efba16d569ef00f8db20eb7c1f3ac80140e5902.zip |
If a base backup is cancelled by server shutdown or crash, throw an error
in WAL recovery when it sees the shutdown checkpoint record. It's more
user-friendly to find out about it at that point than at the end of
recovery, and you're not left wondering why your hot standby server never
opens up for read-only connections.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 3f339825ae7..6812cf5e9a4 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.403 2010/04/23 20:21:31 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.404 2010/04/27 09:25:18 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -7714,6 +7714,16 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record) CheckRequiredParameterValues(checkPoint); /* + * If we see a shutdown checkpoint while waiting for an + * end-of-backup record, the backup was cancelled and the + * end-of-backup record will never arrive. + */ + if (InArchiveRecovery && + !XLogRecPtrIsInvalid(ControlFile->backupStartPoint)) + ereport(ERROR, + (errmsg("online backup was cancelled, recovery cannot continue"))); + + /* * If we see a shutdown checkpoint, we know that nothing was * running on the master at this point. So fake-up an empty * running-xacts record and use that here and now. Recover |