diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 6bc1a6b46d..c9bf48748e 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7307,6 +7307,32 @@ StartupXLOG(void) case RECOVERY_TARGET_ACTION_PROMOTE: break; } + } else if (recoveryTarget == RECOVERY_TARGET_TIME || + recoveryTarget == RECOVERY_TARGET_XID || + recoveryTarget == RECOVERY_TARGET_NAME || + recoveryTarget == RECOVERY_TARGET_LSN) + { + /* + * Stop point not reached and next WAL could not be read + * Report transaction log time and pause recovery + */ + switch (recoveryTargetAction) + { + case RECOVERY_TARGET_ACTION_PAUSE: + ereport(LOG, + (errmsg("Recovery target not reached but next WAL record culd not be read"))); + ereport(LOG, + (errmsg("redo done at %X/%X", + (uint32)(ReadRecPtr >> 32), (uint32)ReadRecPtr))); + xtime = GetLatestXTime(); + if (xtime) + ereport(LOG, + (errmsg("last completed transaction was at log time %s", + timestamptz_to_str(xtime)))); + SetRecoveryPause(true); + recoveryPausesHere(); + break; + } } /* Allow resource managers to do any required cleanup. */