aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-07-22 21:09:37 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-07-22 21:09:37 +0000
commitacd907bfccafdf4bc1ef9e2beed8d69278de640a (patch)
treec6cd2287910dcf1cef5f2f0f4524639ee4a9f19d
parent3dba9cb694070829ccf132fe69195ad9203cc73b (diff)
downloadpostgresql-acd907bfccafdf4bc1ef9e2beed8d69278de640a.tar.gz
postgresql-acd907bfccafdf4bc1ef9e2beed8d69278de640a.zip
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.
-rw-r--r--src/backend/access/transam/xlog.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 54a71b8f79d..f9a49332ba6 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.151 2004/07/22 20:18:40 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.152 2004/07/22 21:09:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -4009,6 +4009,18 @@ StartupXLOG(void)
expectedTLIs = readTimeLineHistory(recoveryTargetTLI);
/*
+ * If pg_control's timeline is not in expectedTLIs, then we cannot
+ * proceed: the backup is not part of the history of the requested
+ * timeline.
+ */
+ if (!list_member_int(expectedTLIs,
+ (int) ControlFile->checkPointCopy.ThisTimeLineID))
+ ereport(FATAL,
+ (errmsg("requested timeline %u is not a child of database system timeline %u",
+ recoveryTargetTLI,
+ ControlFile->checkPointCopy.ThisTimeLineID)));
+
+ /*
* Get the last valid checkpoint record. If the latest one according
* to pg_control is broken, try the next-to-last one.
*/