From 6c4f6664b201bea77eb6e3f813559e3911a5ef35 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Fri, 22 Feb 2013 13:07:02 +0200 Subject: [PATCH] Fix thinko in previous commit. We must still initialize minRecoveryPoint if we start straight with archive recovery, e.g when recovering from a normal base backup taken with pg_start/stop_backup. Otherwise we never consider the system consistent. --- src/backend/access/transam/xlog.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 29d1f960c1..d960bbcc20 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5265,6 +5265,15 @@ StartupXLOG(void) ControlFile->prevCheckPoint = ControlFile->checkPoint; ControlFile->checkPoint = checkPointLoc; ControlFile->checkPointCopy = checkPoint; + if (InArchiveRecovery) + { + /* initialize minRecoveryPoint if not set yet */ + if (ControlFile->minRecoveryPoint < checkPoint.redo) + { + ControlFile->minRecoveryPoint = checkPoint.redo; + ControlFile->minRecoveryPointTLI = checkPoint.ThisTimeLineID; + } + } /* * Set backupStartPoint if we're starting recovery from a base backup.