/* are we currently in standby mode? */
bool StandbyMode = false;
-/* whether request for fast promotion has been made yet */
-static bool fast_promote = false;
-
/*
* if recoveryStopsBefore/After returns true, it saves information of the stop
* point here
DBState dbstate_at_startup;
XLogReaderState *xlogreader;
XLogPageReadPrivate private;
- bool fast_promoted = false;
+ bool promoted = false;
struct stat st;
/*
* the rule that TLI only changes in shutdown checkpoints, which
* allows some extra error checking in xlog_redo.
*
- * In fast promotion, only create a lightweight end-of-recovery record
+ * In promotion, only create a lightweight end-of-recovery record
* instead of a full checkpoint. A checkpoint is requested later,
* after we're fully out of recovery mode and already accepting
* queries.
*/
if (bgwriterLaunched)
{
- if (fast_promote)
+ if (LocalPromoteIsTriggered)
{
checkPointLoc = ControlFile->checkPoint;
record = ReadCheckpointRecord(xlogreader, checkPointLoc, 1, false);
if (record != NULL)
{
- fast_promoted = true;
+ promoted = true;
/*
* Insert a special WAL record to mark the end of
}
}
- if (!fast_promoted)
+ if (!promoted)
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
CHECKPOINT_IMMEDIATE |
CHECKPOINT_WAIT);
WalSndWakeup();
/*
- * If this was a fast promotion, request an (online) checkpoint now. This
+ * If this was a promotion, request an (online) checkpoint now. This
* isn't required for consistency, but the last restartpoint might be far
* back, and in case of a crash, recovering from it might take a longer
* than is appropriate now that we're not in standby mode anymore.
*/
- if (fast_promoted)
+ if (promoted)
RequestCheckpoint(CHECKPOINT_FORCE);
}
if (LocalPromoteIsTriggered)
return true;
- if (IsPromoteSignaled())
+ if (IsPromoteSignaled() && CheckPromoteSignal())
{
- /*
- * In 9.1 and 9.2 the postmaster unlinked the promote file inside the
- * signal handler. It now leaves the file in place and lets the
- * Startup process do the unlink. This allows Startup to know whether
- * it should create a full checkpoint before starting up (fallback
- * mode). Fast promotion takes precedence.
- */
- if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
- {
- unlink(PROMOTE_SIGNAL_FILE);
- unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
- fast_promote = true;
- }
- else if (stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
- {
- unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
- fast_promote = false;
- }
-
ereport(LOG, (errmsg("received promote request")));
-
+ RemovePromoteSignalFiles();
ResetPromoteSignaled();
SetPromoteIsTriggered();
return true;
(errmsg("promote trigger file found: %s", PromoteTriggerFile)));
unlink(PromoteTriggerFile);
SetPromoteIsTriggered();
- fast_promote = true;
return true;
}
else if (errno != ENOENT)
RemovePromoteSignalFiles(void)
{
unlink(PROMOTE_SIGNAL_FILE);
- unlink(FALLBACK_PROMOTE_SIGNAL_FILE);
}
/*
- * Check to see if a promote request has arrived. Should be
- * called by postmaster after receiving SIGUSR1.
+ * Check to see if a promote request has arrived.
*/
bool
CheckPromoteSignal(void)
{
struct stat stat_buf;
- if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0 ||
- stat(FALLBACK_PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
+ if (stat(PROMOTE_SIGNAL_FILE, &stat_buf) == 0)
return true;
return false;