Skip to content

Commit acd907b

Browse files
committed
Add cross-check that current timeline of pg_control is an ancestor of
recovery_target_timeline --- otherwise there is no path from the backup to the requested timeline. This check was foreseen in the original discussion but I forgot to implement it.
1 parent 3dba9cb commit acd907b

File tree

1 file changed

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

1 file changed

+13
-1
lines changed

src/backend/access/transam/xlog.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, 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.151 2004/07/22 20:18:40 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.152 2004/07/22 21:09:37 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -4008,6 +4008,18 @@ StartupXLOG(void)
40084008
/* Now we can determine the list of expected TLIs */
40094009
expectedTLIs = readTimeLineHistory(recoveryTargetTLI);
40104010

4011+
/*
4012+
* If pg_control's timeline is not in expectedTLIs, then we cannot
4013+
* proceed: the backup is not part of the history of the requested
4014+
* timeline.
4015+
*/
4016+
if (!list_member_int(expectedTLIs,
4017+
(int) ControlFile->checkPointCopy.ThisTimeLineID))
4018+
ereport(FATAL,
4019+
(errmsg("requested timeline %u is not a child of database system timeline %u",
4020+
recoveryTargetTLI,
4021+
ControlFile->checkPointCopy.ThisTimeLineID)));
4022+
40114023
/*
40124024
* Get the last valid checkpoint record. If the latest one according
40134025
* to pg_control is broken, try the next-to-last one.

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