aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 6e09ded5974..3813eadfb49 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6200,7 +6200,7 @@ StartupXLOG(void)
XLogCtlInsert *Insert;
CheckPoint checkPoint;
bool wasShutdown;
- bool reachedStopPoint = false;
+ bool reachedRecoveryTarget = false;
bool haveBackupLabel = false;
bool haveTblspcMap = false;
XLogRecPtr RecPtr,
@@ -7103,7 +7103,7 @@ StartupXLOG(void)
*/
if (recoveryStopsBefore(xlogreader))
{
- reachedStopPoint = true; /* see below */
+ reachedRecoveryTarget = true;
break;
}
@@ -7258,7 +7258,7 @@ StartupXLOG(void)
/* Exit loop if we reached inclusive recovery target */
if (recoveryStopsAfter(xlogreader))
{
- reachedStopPoint = true;
+ reachedRecoveryTarget = true;
break;
}
@@ -7270,7 +7270,7 @@ StartupXLOG(void)
* end of main redo apply loop
*/
- if (reachedStopPoint)
+ if (reachedRecoveryTarget)
{
if (!reachedConsistency)
ereport(FATAL,
@@ -7327,7 +7327,18 @@ StartupXLOG(void)
/* there are no WAL records following the checkpoint */
ereport(LOG,
(errmsg("redo is not required")));
+
}
+
+ /*
+ * This check is intentionally after the above log messages that
+ * indicate how far recovery went.
+ */
+ if (ArchiveRecoveryRequested &&
+ recoveryTarget != RECOVERY_TARGET_UNSET &&
+ !reachedRecoveryTarget)
+ ereport(FATAL,
+ (errmsg("recovery ended before configured recovery target was reached")));
}
/*