* database is consistent.
*
* If 'force' is true, 'lsn' argument is ignored. Otherwise, minRecoveryPoint
- * is is only updated if it's already greater than or equal to 'lsn'.
+ * is is only updated if it's not already greater than or equal to 'lsn'.
*/
static void
UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
XLogRecPtr newMinRecoveryPoint;
/*
- * To avoid having to update the control file too often, we update
- * it all the way to the last record being replayed, even though 'lsn'
+ * To avoid having to update the control file too often, we update it
+ * all the way to the last record being replayed, even though 'lsn'
* would suffice for correctness.
*/
SpinLockAcquire(&xlogctl->info_lck);
/*
* Set in_restore_command to tell the signal handler that we should exit
* right away on SIGTERM. We know that we're in a safe point to do that.
- * Check if we had already received the signal, so that we don't miss
- * a shutdown request received just before this.
+ * Check if we had already received the signal, so that we don't miss a
+ * shutdown request received just before this.
*/
in_restore_command = true;
if (shutdown_requested)
/*
* Acquire CheckpointLock to ensure only one checkpoint happens at a time.
* During normal operation, bgwriter is the only process that creates
- * checkpoints, but at the end archive recovery, the bgwriter can be busy
- * creating a restartpoint while the startup process tries to perform the
- * startup checkpoint.
+ * checkpoints, but at the end of archive recovery, the bgwriter can be
+ * busy creating a restartpoint while the startup process tries to perform
+ * the startup checkpoint.
*/
if (!LWLockConditionalAcquire(CheckpointLock, LW_EXCLUSIVE))
{
/*
* XLOG resource manager's routines
*
- * Definitions of message info are in include/catalog/pg_control.h,
- * though not all messages relate to control file processing.
+ * Definitions of info values are in include/catalog/pg_control.h, though
+ * not all records types are related to control file processing.
*/
void
xlog_redo(XLogRecPtr lsn, XLogRecord *record)
* states, nor in PM_SHUTDOWN states (because we don't enter those states
* when trying to recover from a crash). It can be true in PM_STARTUP state,
* because we don't clear it until we've successfully started WAL redo.
+ * Similarly, RecoveryError means that we have crashed during recovery, and
+ * should not try to restart.
*/
typedef enum
{
/*
* Check if we've received a signal from the startup process
* first. This can change pmState. If the startup process sends
- * a signal, and exits immediately after that, we might not have
- * processed the signal yet, and we need to know if it completed
- * recovery before exiting.
+ * a signal and exits immediately after that, we might not have
+ * processed the signal yet. We need to know if it completed
+ * recovery before it exited.
*/
CheckRecoverySignals();
As of 8.4, background writer starts during recovery mode when there is
some form of potentially extended recovery to perform. It performs an
identical service to normal processing, except that checkpoints it
-writes are technically restartpoints. Flushing outstanding WAL for dirty
-buffers is also skipped, though there shouldn't ever be new WAL entries
-at that time in any case. We could choose to start background writer
-immediately but we hold off until we can prove the database is in a
-consistent state so that postmaster has a single, clean state change.
+writes are technically restartpoints.
{
PMSIGNAL_RECOVERY_STARTED, /* recovery has started */
PMSIGNAL_RECOVERY_CONSISTENT, /* recovery has reached consistent state */
- PMSIGNAL_RECOVERY_COMPLETED, /* recovery completed */
+ PMSIGNAL_RECOVERY_COMPLETED, /* recovery has completed */
PMSIGNAL_PASSWORD_CHANGE, /* pg_auth file has changed */
PMSIGNAL_WAKEN_ARCHIVER, /* send a NOTIFY signal to xlog archiver */
PMSIGNAL_ROTATE_LOGFILE, /* send SIGUSR1 to syslogger to rotate logfile */