Skip to content

Commit 3efba16

Browse files
committed
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.
1 parent 3456cf1 commit 3efba16

File tree

1 file changed

+11
-1
lines changed
  • src/backend/access/transam

1 file changed

+11
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.403 2010/04/23 20:21:31 sriggs Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.404 2010/04/27 09:25:18 heikki Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -7713,6 +7713,16 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
77137713
if (standbyState != STANDBY_DISABLED)
77147714
CheckRequiredParameterValues(checkPoint);
77157715

7716+
/*
7717+
* If we see a shutdown checkpoint while waiting for an
7718+
* end-of-backup record, the backup was cancelled and the
7719+
* end-of-backup record will never arrive.
7720+
*/
7721+
if (InArchiveRecovery &&
7722+
!XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
7723+
ereport(ERROR,
7724+
(errmsg("online backup was cancelled, recovery cannot continue")));
7725+
77167726
/*
77177727
* If we see a shutdown checkpoint, we know that nothing was
77187728
* running on the master at this point. So fake-up an empty

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy