/*
* Are we doing recovery from XLOG?
*
- * This is only ever true in the startup process, when it's replaying WAL.
- * It's used in functions that need to act differently when called from a
- * redo function (e.g skip WAL logging). To check whether the system is in
- * recovery regardless of what process you're running in, use
- * IsRecoveryProcessingMode().
+ * This is only ever true in the startup process, even if the system is still
+ * in recovery. Prior to 8.4, all activity during recovery were carried out
+ * by Startup process. This local variable continues to be used in functions
+ * that need to act differently when called from a redo function (e.g skip
+ * WAL logging). To check whether the system is in recovery regardless of what
+ * process you're running in, use RecoveryInProgress().
*/
bool InRecovery = false;
static bool InArchiveRecovery = false;
/*
- * Local copy of shared RecoveryProcessingMode variable. True actually
- * means "not known, need to check the shared state"
+ * Local copy of SharedRecoveryInProgress variable. True actually means "not
+ * known, need to check the shared state"
*/
-static bool LocalRecoveryProcessingMode = true;
+static bool LocalRecoveryInProgress = true;
/* Was the last xlog file restored from archive, or local? */
static bool restoredFromArchive = false;
TimeLineID ThisTimeLineID;
/*
- * SharedRecoveryProcessingMode indicates if we're still in crash or
- * archive recovery. It's checked by IsRecoveryProcessingMode().
+ * SharedRecoveryInProgress indicates if we're still in crash or archive
+ * recovery. It's checked by RecoveryInProgress().
*/
- bool SharedRecoveryProcessingMode;
+ bool SharedRecoveryInProgress;
/*
* During recovery, we keep a copy of the latest checkpoint record
bool isLogSwitch = (rmid == RM_XLOG_ID && info == XLOG_SWITCH);
/* cross-check on whether we should be here or not */
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
elog(FATAL, "cannot make new WAL entries during recovery");
/* info's high bits are reserved for use by me */
* During REDO, we don't try to flush the WAL, but update minRecoveryPoint
* instead.
*/
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
{
UpdateMinRecoveryPoint(record, false);
return;
* the bad page is encountered again during recovery then we would be
* unable to restart the database at all! (This scenario has actually
* happened in the field several times with 7.1 releases. Note that we
- * cannot get here while IsRecoveryProcessingMode(), but if the bad page is
+ * cannot get here while RecoveryInProgress(), but if the bad page is
* brought in and marked dirty during recovery then if a checkpoint were
* performed at the end of recovery it will try to flush it.
*
bool flexible = true;
/* XLOG doesn't need flushing during recovery */
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
return;
/* read LogwrtResult and update local state */
volatile XLogCtlData *xlogctl = XLogCtl;
/* There's no asynchronously committed transactions during recovery */
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
return;
SpinLockAcquire(&xlogctl->info_lck);
XLogNeedsFlush(XLogRecPtr record)
{
/* XLOG doesn't need flushing during recovery */
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
return false;
/* Quick exit if already known flushed */
uint32 freespace;
TransactionId oldestActiveXID;
- XLogCtl->SharedRecoveryProcessingMode = true;
+ XLogCtl->SharedRecoveryInProgress = true;
/*
* Read control file and check XLOG status looks valid.
* Allow writing WAL for us, so that we can create a checkpoint record.
* But not yet for other backends!
*/
- LocalRecoveryProcessingMode = false;
+ LocalRecoveryInProgress = false;
if (InRecovery)
{
/*
* All done. Allow others to write WAL.
*/
- XLogCtl->SharedRecoveryProcessingMode = false;
+ XLogCtl->SharedRecoveryInProgress = false;
}
/*
* variables the first time we see that recovery is finished.
*/
bool
-IsRecoveryProcessingMode(void)
+RecoveryInProgress(void)
{
/*
* We check shared state each time only until we leave recovery mode.
* We can't re-enter recovery, so we rely on the local state variable
* after that.
*/
- if (!LocalRecoveryProcessingMode)
+ if (!LocalRecoveryInProgress)
return false;
else
{
/* use volatile pointer to prevent code rearrangement */
volatile XLogCtlData *xlogctl = XLogCtl;
- LocalRecoveryProcessingMode = xlogctl->SharedRecoveryProcessingMode;
+ LocalRecoveryInProgress = xlogctl->SharedRecoveryInProgress;
/*
* Initialize TimeLineID and RedoRecPtr the first time we see that
* recovery is finished.
*/
- if (!LocalRecoveryProcessingMode)
+ if (!LocalRecoveryInProgress)
InitXLOGAccess();
- return LocalRecoveryProcessingMode;
+ return LocalRecoveryInProgress;
}
}
ereport(LOG,
(errmsg("shutting down")));
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
else
CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
int nInCommit;
/* shouldn't happen */
- if (IsRecoveryProcessingMode())
+ if (RecoveryInProgress())
elog(ERROR, "can't create a checkpoint during recovery");
/*
* Check that we're still in recovery mode. It's ok if we exit recovery
* mode after this check, the restart point is valid anyway.
*/
- if (!IsRecoveryProcessingMode())
+ if (!RecoveryInProgress())
{
ereport(DEBUG2,
(errmsg("skipping restartpoint, recovery has already ended")));