}
#endif
+ /*
+ * Have we reached our safe starting point? If so, we can
+ * signal postmaster to enter consistent recovery mode.
+ *
+ * There are two points in the log we must pass. The first is
+ * the minRecoveryPoint, which is the LSN at the time the
+ * base backup was taken that we are about to rollfoward from.
+ * If recovery has ever crashed or was stopped there is
+ * another point also: minSafeStartPoint, which is the
+ * latest LSN that recovery could have reached prior to crash.
+ */
+ if (!reachedSafeStartPoint &&
+ XLByteLE(minSafeStartPoint, EndRecPtr) &&
+ XLByteLE(ControlFile->minRecoveryPoint, EndRecPtr))
+ {
+ reachedSafeStartPoint = true;
+ if (InArchiveRecovery)
+ {
+ ereport(LOG,
+ (errmsg("consistent recovery state reached at %X/%X",
+ EndRecPtr.xlogid, EndRecPtr.xrecoff)));
+ if (IsUnderPostmaster)
+ SendPostmasterSignal(PMSIGNAL_RECOVERY_START);
+ }
+ }
+
/*
* Have we reached our recovery target?
*/
LastRec = ReadRecPtr;
- /*
- * Have we reached our safe starting point? If so, we can
- * signal postmaster to enter consistent recovery mode.
- *
- * There are two points in the log we must pass. The first is
- * the minRecoveryPoint, which is the LSN at the time the
- * base backup was taken that we are about to rollfoward from.
- * If recovery has ever crashed or was stopped there is
- * another point also: minSafeStartPoint, which is the
- * latest LSN that recovery could have reached prior to crash.
- */
- if (!reachedSafeStartPoint &&
- XLByteLE(minSafeStartPoint, EndRecPtr) &&
- XLByteLE(ControlFile->minRecoveryPoint, EndRecPtr))
- {
- reachedSafeStartPoint = true;
- if (InArchiveRecovery)
- {
- ereport(LOG,
- (errmsg("consistent recovery state reached at %X/%X",
- EndRecPtr.xlogid, EndRecPtr.xrecoff)));
- if (IsUnderPostmaster)
- SendPostmasterSignal(PMSIGNAL_RECOVERY_START);
- }
- }
-
record = ReadRecord(NULL, LOG);
} while (record != NULL && recoveryContinue);