62#include "utils/fmgrprotos.h"
70#define RECOVERY_COMMAND_FILE "recovery.conf"
71#define RECOVERY_COMMAND_DONE "recovery.done"
423 int emode,
bool fetching_ckpt,
565 .segment_open =
NULL,
572 errdetail(
"Failed while allocating a WAL reading processor.")));
624 errmsg(
"starting backup recovery with redo LSN %X/%08X, checkpoint LSN %X/%08X, on timeline ID %u",
656 errmsg(
"could not find redo location %X/%08X referenced by checkpoint record at %X/%08X",
658 errhint(
"If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
659 "If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
660 "Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
667 errmsg(
"could not locate required checkpoint record at %X/%08X",
669 errhint(
"If you are restoring from a backup, touch \"%s/recovery.signal\" or \"%s/standby.signal\" and add required recovery options.\n"
670 "If you are not restoring from a backup, try removing the file \"%s/backup_label\".\n"
671 "Be careful: removing \"%s/backup_label\" will result in a corrupt cluster if restoring from a backup.",
681 foreach(
lc, tablespaces)
697 errmsg(
"could not create symbolic link \"%s\": %m",
730 (
errmsg(
"ignoring file \"%s\" because no file \"%s\" exists",
732 errdetail(
"File \"%s\" was renamed to \"%s\".",
736 (
errmsg(
"ignoring file \"%s\" because no file \"%s\" exists",
738 errdetail(
"Could not rename file \"%s\" to \"%s\": %m.",
777 errmsg(
"restarting backup recovery with redo LSN %X/%08X",
802 errmsg(
"could not locate a valid checkpoint record at %X/%08X",
814 errmsg(
"could not find redo location %X/%08X referenced by checkpoint record at %X/%08X",
823 (
errmsg(
"entering standby mode")));
826 (
errmsg(
"starting point-in-time recovery to XID %u",
830 (
errmsg(
"starting point-in-time recovery to %s",
834 (
errmsg(
"starting point-in-time recovery to \"%s\"",
838 errmsg(
"starting point-in-time recovery to WAL location (LSN) \"%X/%08X\"",
842 (
errmsg(
"starting point-in-time recovery to earliest consistent point")));
845 (
errmsg(
"starting archive recovery")));
866 (
errmsg(
"requested timeline %u is not a child of this server's history",
869 errdetail(
"Latest checkpoint in file \"%s\" is at %X/%08X on timeline %u, but in the history of the requested timeline, the server forked off from that timeline at %X/%08X.",
884 errmsg(
"requested timeline %u does not contain minimum recovery point %X/%08X on timeline %u",
912 (
errmsg(
"invalid next transaction ID")));
917 (
errmsg(
"invalid redo in checkpoint record")));
928 (
errmsg(
"invalid redo record in shutdown checkpoint")));
957 (
errmsg(
"database system was not properly shut down; "
958 "automatic recovery in progress")));
961 (
errmsg(
"crash recovery starts in timeline %u "
962 "and has target timeline %u",
1004 (
errmsg(
"backup_label contains data inconsistent with control file"),
1005 errhint(
"This means that the backup is corrupted and you will "
1006 "have to use another backup for recovery.")));
1059 errmsg(
"using recovery command file \"%s\" is not supported",
1124 errmsg(
"standby mode is not supported by single-user servers")));
1141 (
errmsg(
"specified neither \"primary_conninfo\" nor \"restore_command\""),
1142 errhint(
"The database server will regularly poll the pg_wal subdirectory to check for files placed there.")));
1150 errmsg(
"must specify \"restore_command\" when standby mode is not enabled")));
1188 errmsg(
"recovery target timeline %u does not exist",
1257 errmsg(
"could not read file \"%s\": %m",
1267 if (
fscanf(
lfp,
"START WAL LOCATION: %X/%08X (file %08X%16s)%c",
1274 if (
fscanf(
lfp,
"CHECKPOINT LOCATION: %X/%08X%c",
1275 &hi, &lo, &
ch) != 3 ||
ch !=
'\n')
1338 errdetail(
"Timeline ID parsed is %u, but expected %u.",
1346 if (
fscanf(
lfp,
"INCREMENTAL FROM LSN: %X/%08X\n", &hi, &lo) > 0)
1349 errmsg(
"this is an incremental backup, not a data directory"),
1350 errhint(
"Use pg_combinebackup to reconstruct a valid data directory.")));
1355 errmsg(
"could not read file \"%s\": %m",
1392 errmsg(
"could not read file \"%s\": %m",
1420 while (
str[n] &&
str[n] !=
' ')
1436 *tablespaces =
lappend(*tablespaces,
ti);
1445 if (
i <
sizeof(
str) - 1)
1459 errmsg(
"could not read file \"%s\": %m",
1737 errmsg(
"unexpected record type found at redo point %X/%08X",
1760 errmsg(
"redo starts at %X/%08X",
1863 }
while (record !=
NULL);
1873 (
errmsg(
"requested recovery stop point is before consistent recovery point")));
1905 errmsg(
"redo done at %X/%08X system usage: %s",
1911 (
errmsg(
"last completed transaction was at log time %s",
1920 (
errmsg(
"redo is not required")));
1932 errmsg(
"recovery ended before configured recovery target was reached")));
2117 elog(
FATAL,
"mismatching overwritten LSN %X/%08X -> %X/%08X",
2126 errmsg(
"successfully skipped missing contrecord at %X/%08X, overwritten at %s",
2149 elog(
DEBUG1,
"end of backup record reached");
2154 elog(
DEBUG1,
"saw end-of-backup record for backup starting at %X/%08X, waiting for %X/%08X",
2193 errmsg(
"unexpected directory entry \"%s\" found in %s",
2195 errdetail(
"All directory entries in %s/ should be symbolic links.",
2197 errhint(
"Remove those directories, or set \"allow_in_place_tablespaces\" to ON transiently to let recovery complete.")));
2249 errmsg(
"completed backup recovery with redo LSN %X/%08X and end LSN %X/%08X",
2280 errmsg(
"consistent recovery state reached at %X/%08X",
2339 id =
rmgr.rm_identify(info);
2381 &rlocator, &forknum, &
blk,
NULL))
2416 (
errmsg(
"unexpected previous timeline ID %u (current timeline ID %u) in checkpoint record",
2425 (
errmsg(
"unexpected timeline ID %u (after %u) in checkpoint record",
2441 errmsg(
"unexpected timeline ID %u in checkpoint record, before reaching minimum recovery point %X/%08X on timeline %u",
2514 &rlocator, &forknum, &blkno,
NULL))
2590 "inconsistent page found, rel %u/%u/%u, forknum %u, blkno %u",
2625 (
errmsg(
"recovery stopping after reaching consistency")));
2646 errmsg(
"recovery stopping before WAL location (LSN) \"%X/%08X\"",
2736 (
errmsg(
"recovery stopping before commit of transaction %u, time %s",
2743 (
errmsg(
"recovery stopping before abort of transaction %u, time %s",
2796 (
errmsg(
"recovery stopping at restore point \"%s\", time %s",
2814 errmsg(
"recovery stopping after WAL location (LSN) \"%X/%08X\"",
2881 (
errmsg(
"recovery stopping after commit of transaction %u, time %s",
2889 (
errmsg(
"recovery stopping after abort of transaction %u, time %s",
2901 (
errmsg(
"recovery stopping after reaching consistency")));
2925 "%s transaction %u",
2940 "at restore point \"%s\"",
2943 snprintf(reason,
sizeof(reason),
"reached consistency");
2945 snprintf(reason,
sizeof(reason),
"no recovery target specified");
2970 (
errmsg(
"pausing at the end of recovery"),
2971 errhint(
"Execute pg_wal_replay_resume() to promote.")));
2974 (
errmsg(
"recovery has paused"),
2975 errhint(
"Execute pg_wal_replay_resume() to continue.")));
3174 private->fetching_ckpt = fetching_ckpt;
3175 private->emode = emode;
3177 private->replayTLI = replayTLI;
3240 errmsg(
"unexpected timeline ID %u in WAL segment %s, LSN %X/%08X, offset %u",
3274 (
errmsg_internal(
"reached end of WAL in pg_wal, entering archive recovery")));
3338 int emode =
private->emode;
3458 errmsg(
"could not read from WAL segment %s, LSN %X/%08X, offset %u: %m",
3465 errmsg(
"could not read from WAL segment %s, LSN %X/%08X, offset %u: read %d of %zu",
3766 elog(
LOG,
"waiting for WAL to become available at %X/%08X",
3803 elog(
DEBUG2,
"switched WAL source from %s to %s after %s",
3912 elog(
ERROR,
"according to history file, WAL location %X/%08X belongs to timeline %u, but previous recovered WAL file came from timeline %u",
3955 if (latestChunkStart <=
RecPtr)
4127 (
errmsg(
"invalid checkpoint location")));
4137 (
errmsg(
"invalid checkpoint record")));
4143 (
errmsg(
"invalid resource manager ID in checkpoint record")));
4151 (
errmsg(
"invalid xl_info in checkpoint record")));
4157 (
errmsg(
"invalid length of checkpoint record")));
4211 (
errmsg(
"new timeline %u is not a child of database system timeline %u",
4225 errmsg(
"new timeline %u forked off current database system timeline %u before current recovery point %X/%08X",
4244 (
errmsg(
"new target timeline is %u",
4330 errmsg(
"could not open file \"%s\": %m", path)));
4407 elog(
DEBUG1,
"got WAL segment from archive");
4431 errmsg(
"could not open file \"%s\": %m", path)));
4445 (
errmsg(
"WAL receiver process shutdown requested")));
4638 *replayEndTLI = tli;
4734 errmsg(
"hot standby is not possible because of insufficient parameter settings"),
4735 errdetail(
"%s = %d is a lower setting than on the primary server, where its value was %d.",
4743 (
errmsg(
"recovery has paused"),
4744 errdetail(
"If recovery is unpaused, the server will shut down."),
4745 errhint(
"You can then restart the server after making the necessary configuration changes.")));
4756 errmsg(
"promotion is not possible because of insufficient parameter settings"),
4762 errdetail(
"%s = %d is a lower setting than on the primary server, where its value was %d.",
4766 errhint(
"Restart the server after making the necessary configuration changes.")));
4790 errmsg(
"recovery aborted because of insufficient parameter settings"),
4792 errdetail(
"%s = %d is a lower setting than on the primary server, where its value was %d.",
4796 errhint(
"You can restart the server after making the necessary configuration changes.")));
4808 char *err_msg =
NULL;
4848 errmsg(
"multiple recovery targets specified"),
4849 errdetail(
"At most one of \"recovery_target\", \"recovery_target_lsn\", \"recovery_target_name\", \"recovery_target_time\", \"recovery_target_xid\" may be set.")));
5064 "recovery_target_timeline");
5071 "recovery_target_timeline", 1,
UINT_MAX);
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
List * readTimeLineHistory(TimeLineID targetTLI)
TimeLineID findNewestTimeLine(TimeLineID startTLI)
TimeLineID tliOfPointInHistory(XLogRecPtr ptr, List *history)
XLogRecPtr tliSwitchPoint(TimeLineID tli, List *history, TimeLineID *nextTLI)
bool existsTimeLineHistory(TimeLineID probeTLI)
void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
bool tliInHistory(TimeLineID tli, List *expectedTLEs)
void remove_tablespace_symlink(const char *linkloc)
bool allow_in_place_tablespaces
void disable_startup_progress_timeout(void)
bool IsPromoteSignaled(void)
void begin_startup_progress_phase(void)
void ProcessStartupProcInterrupts(void)
void ResetPromoteSignaled(void)
int ParseDateTime(const char *timestr, char *workbuf, size_t buflen, char **field, int *ftype, int maxfields, int *numfields)
int DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp, DateTimeErrorExtra *extra)
long TimestampDifferenceMilliseconds(TimestampTz start_time, TimestampTz stop_time)
int tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result)
bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
Datum timestamptz_in(PG_FUNCTION_ARGS)
TimestampTz GetCurrentTimestamp(void)
const char * timestamptz_to_str(TimestampTz t)
Datum now(PG_FUNCTION_ARGS)
void UnlockReleaseBuffer(Buffer buffer)
static Page BufferGetPage(Buffer buffer)
static void LockBuffer(Buffer buffer, BufferLockMode mode)
static bool BufferIsValid(Buffer bufnum)
static XLogRecPtr PageGetLSN(const PageData *page)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
void RequestCheckpoint(int flags)
bool ConditionVariableCancelSleep(void)
bool ConditionVariableTimedSleep(ConditionVariable *cv, long timeout, uint32 wait_event_info)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errdetail(const char *fmt,...)
ErrorContextCallback * error_context_stack
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int BasicOpenFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
int durable_rename(const char *oldfile, const char *newfile, int elevel)
int BasicOpenFile(const char *fileName, int fileFlags)
DIR * AllocateDir(const char *dirname)
struct dirent * ReadDir(DIR *dir, const char *dirname)
FILE * AllocateFile(const char *name, const char *mode)
#define palloc_object(type)
#define palloc0_object(type)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
#define DirectFunctionCall3(func, arg1, arg2, arg3)
bool IsPostmasterEnvironment
void GUC_check_errcode(int sqlerrcode)
void * guc_malloc(int elevel, size_t size)
#define GUC_check_errdetail
#define GUC_check_errhint
void OwnLatch(Latch *latch)
void DisownLatch(Latch *latch)
void InitSharedLatch(Latch *latch)
void SetLatch(Latch *latch)
void ResetLatch(Latch *latch)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
List * lappend(List *list, void *datum)
void list_free_deep(List *list)
char * pstrdup(const char *in)
void pfree(void *pointer)
#define AmStartupProcess()
#define IsBootstrapProcessingMode()
#define ERRCODE_DATA_CORRUPTED
#define XLOG_RESTORE_POINT
#define XLOG_CHECKPOINT_REDO
#define XLOG_OVERWRITE_CONTRECORD
@ DB_SHUTDOWNED_IN_RECOVERY
#define XLOG_CHECKPOINT_SHUTDOWN
#define XLOG_CHECKPOINT_ONLINE
#define XLOG_END_OF_RECOVERY
XLogRecPtr pg_lsn_in_safe(const char *str, Node *escontext)
static rewind_source * source
const char * pg_rusage_show(const PGRUsage *ru0)
void pg_rusage_init(PGRUsage *ru0)
static char buf[DEFAULT_XLOG_SEG_SIZE]
instr_time pgstat_prepare_io_time(bool track_io_guc)
void pgstat_count_io_op_time(IOObject io_object, IOContext io_context, IOOp io_op, instr_time start_time, uint32 cnt, uint64 bytes)
void SendPostmasterSignal(PMSignalReason reason)
@ PMSIGNAL_RECOVERY_STARTED
@ PMSIGNAL_BEGIN_HOT_STANDBY
@ PMSIGNAL_RECOVERY_CONSISTENT
size_t strlcpy(char *dst, const char *src, size_t siz)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
static int fd(const char *x, int i)
void RecordKnownAssignedTransactionIds(TransactionId xid)
void KnownAssignedTransactionIdsIdleMaintenance(void)
static void set_ps_display(const char *activity)
char * psprintf(const char *fmt,...)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
bool ReplicationSlotValidateNameInternal(const char *name, bool allow_reserved_name, int *err_code, char **err_msg, char **err_hint)
void ShutDownSlotSync(void)
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
#define ereport_startup_progress(msg,...)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
MultiXactOffset nextMultiOffset
TransactionId newestCommitTsXid
TimeLineID PrevTimeLineID
TimeLineID ThisTimeLineID
FullTransactionId nextXid
TransactionId oldestCommitTsXid
XLogRecPtr backupStartPoint
CheckPoint checkPointCopy
XLogRecPtr backupEndPoint
XLogRecPtr minRecoveryPoint
TimeLineID minRecoveryPointTLI
bool standby_signal_file_found
XLogRecPtr lastPageBeginPtr
char * recoveryStopReason
XLogRecPtr missingContrecPtr
bool recovery_signal_file_found
struct ErrorContextCallback * previous
void(* callback)(void *arg)
void(* rm_redo)(XLogReaderState *record)
pg_atomic_uint64 minWaitedLSN[WAIT_LSN_TYPE_COUNT]
XLogRecPtr missingContrecPtr
XLogRecPtr overwrittenRecPtr
ConditionVariable recoveryNotPausedCV
XLogRecPtr lastReplayedEndRecPtr
bool SharedHotStandbyActive
TimeLineID lastReplayedTLI
bool SharedPromoteIsTriggered
TimestampTz currentChunkStartTime
XLogRecPtr replayEndRecPtr
Latch recoveryWakeupLatch
TimestampTz recoveryLastXTime
RecoveryPauseState recoveryPauseState
XLogRecPtr lastReplayedReadRecPtr
#define InvalidTransactionId
#define U64FromFullTransactionId(x)
#define XidFromFullTransactionId(x)
#define TransactionIdIsValid(xid)
#define TransactionIdIsNormal(xid)
#define TimestampTzPlusMilliseconds(tz, ms)
static TimestampTz DatumGetTimestampTz(Datum X)
void AdvanceNextFullTransactionIdPastXid(TransactionId xid)
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
#define WL_EXIT_ON_PM_DEATH
void WalRcvForceReply(void)
#define AllowCascadeReplication()
XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI)
bool WalRcvStreaming(void)
void RequestXLogStreaming(TimeLineID tli, XLogRecPtr recptr, const char *conninfo, const char *slotname, bool create_temp_slot)
WalRcvState WalRcvGetState(void)
void WalSndWakeup(bool physical, bool logical)
#define symlink(oldpath, newpath)
#define XLOG_XACT_COMMIT_PREPARED
#define XLOG_XACT_ABORT_PREPARED
void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed)
void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed)
int wal_decode_buffer_size
XLogRecPtr GetRedoRecPtr(void)
void SetInstallXLogFileSegmentActive(void)
bool IsInstallXLogFileSegmentActive(void)
void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI)
void RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli)
void ResetInstallXLogFileSegmentActive(void)
int wal_retrieve_retry_interval
static ControlFileData * ControlFile
void XLogShutdownWalRcv(void)
bool XLogCheckpointNeeded(XLogSegNo new_segno)
#define TABLESPACE_MAP_OLD
#define STANDBY_SIGNAL_FILE
#define CHECKPOINT_CAUSE_XLOG
#define PROMOTE_SIGNAL_FILE
#define BACKUP_LABEL_FILE
#define RECOVERY_SIGNAL_FILE
static RmgrData GetRmgr(RmgrId rmid)
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes)
static void XLogFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
#define XRecOffIsValid(xlrp)
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
#define XLByteInSeg(xlrp, logSegNo, wal_segsz_bytes)
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
void KeepFileRestoredFromArchive(const char *path, const char *xlogfname)
#define XLogRecPtrIsValid(r)
#define LSN_FORMAT_ARGS(lsn)
#define InvalidXLogRecPtr
void XLogPrefetcherComputeStats(XLogPrefetcher *prefetcher)
XLogPrefetcher * XLogPrefetcherAllocate(XLogReaderState *reader)
void XLogPrefetchReconfigure(void)
XLogRecord * XLogPrefetcherReadRecord(XLogPrefetcher *prefetcher, char **errmsg)
XLogReaderState * XLogPrefetcherGetReader(XLogPrefetcher *prefetcher)
void XLogPrefetcherBeginRead(XLogPrefetcher *prefetcher, XLogRecPtr recPtr)
void XLogPrefetcherFree(XLogPrefetcher *prefetcher)
bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum, Buffer *prefetch_buffer)
XLogReaderState * XLogReaderAllocate(int wal_segment_size, const char *waldir, XLogReaderRoutine *routine, void *private_data)
void XLogReaderSetDecodeBuffer(XLogReaderState *state, void *buffer, size_t size)
void XLogReaderResetError(XLogReaderState *state)
bool XLogReaderValidatePageHeader(XLogReaderState *state, XLogRecPtr recptr, char *phdr)
void XLogReaderFree(XLogReaderState *state)
bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
#define XLogRecGetDataLen(decoder)
#define XLogRecGetInfo(decoder)
#define XLogRecBlockImageApply(decoder, block_id)
#define XLogRecGetRmid(decoder)
#define XLogRecGetData(decoder)
#define XLogRecGetXid(decoder)
#define XLogRecMaxBlockId(decoder)
#define XLogRecHasBlockImage(decoder, block_id)
#define XLogRecGetPrev(decoder)
#define XLogRecHasAnyBlockRefs(decoder)
#define SizeOfXLogRecordDataHeaderShort
#define XLR_CHECK_CONSISTENCY
bool check_primary_slot_name(char **newval, void **extra, GucSource source)
static bool getRecordTimestamp(XLogReaderState *record, TimestampTz *recordXtime)
static XLogRecPtr recoveryStopLSN
static bool recoveryStopsBefore(XLogReaderState *record)
static TimestampTz recoveryStopTime
void assign_recovery_target_xid(const char *newval, void *extra)
static bool CheckForStandbyTrigger(void)
int recovery_min_apply_delay
bool check_recovery_target(char **newval, void **extra, GucSource source)
static bool backupEndRequired
bool HotStandbyActive(void)
static char * getRecoveryStopReason(void)
void ShutdownWalRecovery(void)
RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal
static void rm_redo_error_callback(void *arg)
static bool recoveryApplyDelay(XLogReaderState *record)
bool ArchiveRecoveryRequested
const char * recoveryTargetName
static void xlogrecovery_redo(XLogReaderState *record, TimeLineID replayTLI)
bool check_recovery_target_timeline(char **newval, void **extra, GucSource source)
static XLogRecPtr minRecoveryPoint
static int XLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetRecPtr, char *readBuf)
static XLogRecPtr backupEndPoint
const struct config_enum_entry recovery_target_action_options[]
static void validateRecoveryParameters(void)
static void checkTimeLineSwitch(XLogRecPtr lsn, TimeLineID newTLI, TimeLineID prevTLI, TimeLineID replayTLI)
static XLogRecord * ReadCheckpointRecord(XLogPrefetcher *xlogprefetcher, XLogRecPtr RecPtr, TimeLineID replayTLI)
void StartupRequestWalReceiverRestart(void)
static bool recoveryStopsAfter(XLogReaderState *record)
void RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue)
static TimeLineID curFileTLI
static char recoveryStopName[MAXFNAMELEN]
static void CheckRecoveryConsistency(void)
static bool pendingWalRcvRestart
void PerformWalRecovery(void)
static XLogSource XLogReceiptSource
bool CheckPromoteSignal(void)
struct XLogPageReadPrivate XLogPageReadPrivate
static bool recoveryStopAfter
static const char *const xlogSourceNames[]
static TimeLineID RedoStartTLI
char * recoveryRestoreCommand
static void verifyBackupPageConsistency(XLogReaderState *record)
static int XLogFileReadAnyTLI(XLogSegNo segno, XLogSource source)
void assign_recovery_target(const char *newval, void *extra)
void SetRecoveryPause(bool recoveryPause)
static bool lastSourceFailed
char * archiveCleanupCommand
XLogRecPtr GetCurrentReplayRecPtr(TimeLineID *replayEndTLI)
static TimeLineID receiveTLI
void WakeupRecovery(void)
void xlog_outdesc(StringInfo buf, XLogReaderState *record)
static bool LocalPromoteIsTriggered
bool PromoteIsTriggered(void)
TimestampTz GetCurrentChunkReplayStartTime(void)
static void ConfirmRecoveryPaused(void)
static void readRecoverySignalFile(void)
static XLogRecPtr missingContrecPtr
static XLogRecoveryCtlData * XLogRecoveryCtl
static bool standby_signal_file_found
char * recovery_target_time_string
static XLogPageReadResult WaitForWALToBecomeAvailable(XLogRecPtr RecPtr, bool randAccess, bool fetching_ckpt, XLogRecPtr tliRecPtr, TimeLineID replayTLI, XLogRecPtr replayLSN, bool nonblocking)
XLogRecPtr recoveryTargetLSN
RecoveryTargetType recoveryTarget
static bool read_tablespace_map(List **tablespaces)
static bool doRequestWalReceiverReply
static bool read_backup_label(XLogRecPtr *checkPointLoc, TimeLineID *backupLabelTLI, bool *backupEndRequired, bool *backupFromStandby)
static int XLogFileRead(XLogSegNo segno, TimeLineID tli, XLogSource source, bool notfoundOk)
static XLogSource currentSource
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
void GetXLogReceiptTime(TimestampTz *rtime, bool *fromStream)
static List * expectedTLEs
static XLogSegNo readSegNo
void assign_recovery_target_name(const char *newval, void *extra)
static XLogRecPtr abortedRecPtr
static char * primary_image_masked
static TimeLineID minRecoveryPointTLI
static XLogRecord * ReadRecord(XLogPrefetcher *xlogprefetcher, int emode, bool fetching_ckpt, TimeLineID replayTLI)
EndOfWalRecoveryInfo * FinishWalRecovery(void)
void assign_recovery_target_time(const char *newval, void *extra)
static void SetCurrentChunkStartTime(TimestampTz xtime)
static XLogRecPtr CheckPointLoc
bool check_recovery_target_xid(char **newval, void **extra, GucSource source)
static bool LocalHotStandbyActive
static bool HotStandbyActiveInReplay(void)
static TransactionId recoveryStopXid
bool check_recovery_target_time(char **newval, void **extra, GucSource source)
static XLogSource readSource
static void SetPromoteIsTriggered(void)
#define RECOVERY_COMMAND_FILE
TransactionId recoveryTargetXid
TimeLineID recoveryTargetTLIRequested
static pg_noreturn void error_multiple_recovery_targets(void)
void InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr, bool *haveBackupLabel_ptr, bool *haveTblspcMap_ptr)
static void xlog_block_info(StringInfo buf, XLogReaderState *record)
static TimestampTz XLogReceiptTime
static void ApplyWalRecord(XLogReaderState *xlogreader, XLogRecord *record, TimeLineID *replayTLI)
Size XLogRecoveryShmemSize(void)
static char * replay_image_masked
bool wal_receiver_create_temp_slot
static void CheckTablespaceDirectory(void)
char * recoveryEndCommand
RecoveryPauseState GetRecoveryPauseState(void)
TimeLineID recoveryTargetTLI
static int emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
void assign_recovery_target_lsn(const char *newval, void *extra)
bool check_recovery_target_lsn(char **newval, void **extra, GucSource source)
static XLogRecPtr RedoStartLSN
static XLogRecPtr flushedUpto
void XLogRecoveryShmemInit(void)
static void recoveryPausesHere(bool endOfRecovery)
static void EnableStandbyMode(void)
#define RECOVERY_COMMAND_DONE
static bool recovery_signal_file_found
TimestampTz recoveryTargetTime
TimestampTz GetLatestXTime(void)
void XLogRequestWalReceiverReply(void)
static bool rescanLatestTimeLine(TimeLineID replayTLI, XLogRecPtr replayLSN)
static XLogPrefetcher * xlogprefetcher
static bool StandbyModeRequested
bool check_recovery_target_name(char **newval, void **extra, GucSource source)
bool recoveryTargetInclusive
static XLogReaderState * xlogreader
void RemovePromoteSignalFiles(void)
void assign_recovery_target_timeline(const char *newval, void *extra)
static XLogRecPtr backupStartPoint
static void SetLatestXTime(TimestampTz xtime)
static TimeLineID CheckPointTLI
@ RECOVERY_TARGET_ACTION_PAUSE
@ RECOVERY_TARGET_ACTION_PROMOTE
@ RECOVERY_TARGET_ACTION_SHUTDOWN
@ RECOVERY_TARGET_IMMEDIATE
RecoveryTargetTimeLineGoal
@ RECOVERY_TARGET_TIMELINE_NUMERIC
@ RECOVERY_TARGET_TIMELINE_CONTROLFILE
@ RECOVERY_TARGET_TIMELINE_LATEST
@ RECOVERY_PAUSE_REQUESTED
void wal_segment_close(XLogReaderState *state)
Buffer XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber forknum, BlockNumber blkno, ReadBufferMode mode, Buffer recent_buffer)
HotStandbyState standbyState
void XLogCheckInvalidPages(void)
struct WaitLSNState * waitLSNState
void WaitLSNWakeup(WaitLSNType lsnType, XLogRecPtr currentLSN)
@ WAIT_LSN_TYPE_STANDBY_REPLAY