4 * Functions for WAL recovery and standby mode
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
9 * src/include/access/xlogrecovery.h
20 * Recovery target type.
21 * Only set during a Point in Time recovery, not when in standby mode.
34 * Recovery target TimeLine goal
44 * Recovery target action.
53/* Recovery pause states */
61/* User-settable GUC parameters */
71/* indirectly set via GUC system */
83/* Have we already reached a consistent database state? */
86/* Are we currently in standby mode? */
93 bool *wasShutdown_ptr,
bool *haveBackupLabel_ptr,
94 bool *haveTblspcMap_ptr);
98 * FinishWalRecovery() returns this. It contains information about the point
99 * where recovery ended, and why it ended.
104 * Information about the last valid or applied record, after which new WAL
105 * can be appended. 'lastRec' is the position where the last record
106 * starts, and 'endOfLog' is its end. 'lastPage' is a copy of the last
107 * partial page that contains endOfLog (or NULL if endOfLog is exactly at
108 * page boundary). 'lastPageBeginPtr' is the position where the last page
111 * endOfLogTLI is the TLI in the filename of the XLOG segment containing
112 * the last applied record. It could be different from lastRecTLI, if
113 * there was a timeline switch in that segment, and we were reading the
114 * old WAL from a segment belonging to a higher timeline.
122 char *
lastPage;
/* copy of the last page, up to endOfLog */
125 * abortedRecPtr is the start pointer of a broken record at end of WAL
126 * when recovery completes; missingContrecPtr is the location of the first
127 * contrecord that went missing. See CreateOverwriteContrecordRecord for
133 /* short human-readable string describing why recovery ended */
137 * If standby or recovery signal file was found, these flags are set
168#endif /* XLOGRECOVERY_H */
bool standby_signal_file_found
XLogRecPtr lastPageBeginPtr
char * recoveryStopReason
XLogRecPtr missingContrecPtr
bool recovery_signal_file_found
static ControlFileData * ControlFile
bool HotStandbyActive(void)
PGDLLIMPORT int recovery_min_apply_delay
void ShutdownWalRecovery(void)
@ RECOVERY_TARGET_ACTION_PAUSE
@ RECOVERY_TARGET_ACTION_PROMOTE
@ RECOVERY_TARGET_ACTION_SHUTDOWN
PGDLLIMPORT TimeLineID recoveryTargetTLIRequested
PGDLLIMPORT TimeLineID recoveryTargetTLI
PGDLLIMPORT TimestampTz recoveryTargetTime
void StartupRequestWalReceiverRestart(void)
void RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue)
void PerformWalRecovery(void)
bool CheckPromoteSignal(void)
PGDLLIMPORT char * PrimarySlotName
void SetRecoveryPause(bool recoveryPause)
XLogRecPtr GetCurrentReplayRecPtr(TimeLineID *replayEndTLI)
@ RECOVERY_TARGET_IMMEDIATE
void WakeupRecovery(void)
void xlog_outdesc(StringInfo buf, XLogReaderState *record)
bool PromoteIsTriggered(void)
TimestampTz GetCurrentChunkReplayStartTime(void)
PGDLLIMPORT XLogRecPtr recoveryTargetLSN
PGDLLIMPORT RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal
PGDLLIMPORT bool wal_receiver_create_temp_slot
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream)
PGDLLIMPORT RecoveryTargetType recoveryTarget
RecoveryTargetTimeLineGoal
@ RECOVERY_TARGET_TIMELINE_NUMERIC
@ RECOVERY_TARGET_TIMELINE_CONTROLFILE
@ RECOVERY_TARGET_TIMELINE_LATEST
EndOfWalRecoveryInfo * FinishWalRecovery(void)
@ RECOVERY_PAUSE_REQUESTED
PGDLLIMPORT bool StandbyMode
void InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr, bool *haveBackupLabel_ptr, bool *haveTblspcMap_ptr)
Size XLogRecoveryShmemSize(void)
PGDLLIMPORT bool recoveryTargetInclusive
RecoveryPauseState GetRecoveryPauseState(void)
void XLogRecoveryShmemInit(void)
PGDLLIMPORT char * recoveryEndCommand
PGDLLIMPORT char * recovery_target_time_string
TimestampTz GetLatestXTime(void)
void XLogRequestWalReceiverReply(void)
PGDLLIMPORT const char * recoveryTargetName
PGDLLIMPORT bool reachedConsistency
void RemovePromoteSignalFiles(void)
PGDLLIMPORT TransactionId recoveryTargetXid
PGDLLIMPORT char * PrimaryConnInfo
PGDLLIMPORT char * archiveCleanupCommand
PGDLLIMPORT char * recoveryRestoreCommand
PGDLLIMPORT int recoveryTargetAction