118#define BootstrapTimeLineID 1
157#define NUM_XLOGINSERT_LOCKS 8
180#ifdef HAVE_FSYNC_WRITETHROUGH
600#define INSERT_FREESPACE(endptr) \
601 (((endptr) % XLOG_BLCKSZ == 0) ? 0 : (XLOG_BLCKSZ - (endptr) % XLOG_BLCKSZ))
604#define NextBufIdx(idx) \
605 (((idx) == XLogCtl->XLogCacheBlck) ? 0 : ((idx) + 1))
611#define XLogRecPtrToBufIdx(recptr) \
612 (((recptr) / XLOG_BLCKSZ) % (XLogCtl->XLogCacheBlck + 1))
617#define UsableBytesInPage (XLOG_BLCKSZ - SizeOfXLogShortPHD)
623#define ConvertToXSegs(x, segsize) XLogMBVarToSegs((x), (segsize))
640#define RefreshXLogWriteResult(_target) \
642 _target.Flush = pg_atomic_read_u64(&XLogCtl->logFlushResult); \
644 _target.Write = pg_atomic_read_u64(&XLogCtl->logWriteResult); \
816 elog(
ERROR,
"cannot make new WAL entries during recovery");
1051 char *errormsg =
NULL;
1076 .segment_open =
NULL,
1077 .segment_close =
NULL),
1090 errormsg ? errormsg :
"no error message");
1294 int rdata_len =
rdata->len;
1296 while (rdata_len > freespace)
1304 rdata_len -= freespace;
1338 currpos += rdata_len;
1340 freespace -= rdata_len;
1405 errmsg_internal(
"space reserved for WAL record does not match what was written"));
1555 elog(
PANIC,
"cannot wait without a PGPROC structure");
1582 errmsg(
"request to flush past end of generated WAL; request %X/%08X, current position %X/%08X",
1677 static uint64 cachedPage = 0;
1749 elog(
PANIC,
"could not find WAL buffer for %X/%08X",
1795 Size nbytes = count;
1809 errmsg(
"cannot read past end of generated WAL: requested %X/%08X, current position %X/%08X",
1857 psrc = page + offset;
2181 elog(
DEBUG1,
"initialized %d pages, up to %X/%08X",
2239 GUC_check_errdetail(
"The WAL segment size must be a power of two between 1 MB and 1 GB.");
2373 elog(
PANIC,
"xlog write request %X/%08X is past end of log %X/%08X",
2475 errmsg(
"could not write to log file \"%s\" at offset %u, length %zu: %m",
2481 }
while (
nleft > 0);
2603#ifdef USE_ASSERT_CHECKING
2773 "xlog min recovery request %X/%08X is past current point %X/%08X",
2786 errmsg_internal(
"updated min recovery point to %X/%08X on timeline %u",
2826 elog(
LOG,
"xlog flush request %X/%08X; write %X/%08X; flush %X/%08X",
2969 "xlog flush request %X/%08X is not satisfied --- flushed only to %X/%08X",
3103 elog(
LOG,
"xlog bg flush request write %X/%08X; flush: %X/%08X, current is write %X/%08X; flush %X/%08X",
3248 bool *
added,
char *path)
3273 errmsg(
"could not open file \"%s\": %m", path)));
3284 elog(
DEBUG2,
"creating and filling new WAL file");
3406 elog(
DEBUG2,
"done creating and filling new WAL file");
3453 errmsg(
"could not open file \"%s\": %m", path)));
3492 errmsg(
"could not open file \"%s\": %m", path)));
3521 if (
nread <
sizeof(buffer))
3528 if (
nread >
sizeof(buffer))
3529 nread =
sizeof(buffer);
3537 errmsg(
"could not read file \"%s\": %m",
3542 errmsg(
"could not read file \"%s\": read %d of %zu",
3549 if ((
int)
write(
fd, buffer.
data,
sizeof(buffer)) != (
int)
sizeof(buffer))
3582 errmsg(
"could not close file \"%s\": %m", path)));
3588 elog(
ERROR,
"InstallXLogFileSegment should not have failed");
3685 errmsg(
"could not open file \"%s\": %m", path)));
3704#if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
3791 if (segno <= lastRemovedSegNo)
3799 errmsg(
"requested WAL segment %s has already been removed",
3821 return lastRemovedSegNo;
3892 elog(
DEBUG2,
"removing all temporary WAL segments");
3904 elog(
DEBUG2,
"removed temporary WAL segment \"%s\"", path);
3940 elog(
DEBUG2,
"attempting to remove WAL segments older than log file %s",
4017 elog(
DEBUG2,
"attempting to remove WAL segments newer than log file %s",
4121 errmsg(
"could not rename file \"%s\": %m",
4164 errmsg(
"required WAL directory \"%s\" does not exist",
4175 errmsg(
"required WAL directory \"%s\" does not exist",
4181 (
errmsg(
"creating missing WAL directory \"%s\"", path)));
4185 errmsg(
"could not create missing directory \"%s\": %m",
4196 (
errmsg(
"required WAL directory \"%s\" does not exist",
4202 (
errmsg(
"creating missing WAL directory \"%s\"", path)));
4205 (
errmsg(
"could not create missing directory \"%s\": %m",
4230 elog(
DEBUG2,
"removing WAL backup history file \"%s\"",
4272 errmsg(
"could not generate secret authorization token")));
4377 errmsg(
"could not create file \"%s\": %m",
4389 errmsg(
"could not write to file \"%s\": %m",
4398 errmsg(
"could not fsync file \"%s\": %m",
4405 errmsg(
"could not close file \"%s\": %m",
4425 errmsg(
"could not open file \"%s\": %m",
4435 errmsg(
"could not read file \"%s\": %m",
4440 errmsg(
"could not read file \"%s\": read %d of %zu",
4457 errmsg(
"database files are incompatible with server"),
4458 errdetail(
"The database cluster was initialized with PG_CONTROL_VERSION %d (0x%08x),"
4459 " but the server was compiled with PG_CONTROL_VERSION %d (0x%08x).",
4462 errhint(
"This could be a problem of mismatched byte ordering. It looks like you need to initdb.")));
4467 errmsg(
"database files are incompatible with server"),
4468 errdetail(
"The database cluster was initialized with PG_CONTROL_VERSION %d,"
4469 " but the server was compiled with PG_CONTROL_VERSION %d.",
4471 errhint(
"It looks like you need to initdb.")));
4483 errmsg(
"incorrect checksum in control file")));
4493 errmsg(
"database files are incompatible with server"),
4495 errdetail(
"The database cluster was initialized with %s %d,"
4496 " but the server was compiled with %s %d.",
4499 errhint(
"It looks like you need to initdb.")));
4503 errmsg(
"database files are incompatible with server"),
4505 errdetail(
"The database cluster was initialized with %s %d,"
4506 " but the server was compiled with %s %d.",
4509 errhint(
"It looks like you need to initdb.")));
4513 errmsg(
"database files are incompatible with server"),
4514 errdetail(
"The database cluster appears to use a different floating-point number format than the server executable."),
4515 errhint(
"It looks like you need to initdb.")));
4519 errmsg(
"database files are incompatible with server"),
4521 errdetail(
"The database cluster was initialized with %s %d,"
4522 " but the server was compiled with %s %d.",
4525 errhint(
"It looks like you need to recompile or initdb.")));
4529 errmsg(
"database files are incompatible with server"),
4531 errdetail(
"The database cluster was initialized with %s %d,"
4532 " but the server was compiled with %s %d.",
4535 errhint(
"It looks like you need to recompile or initdb.")));
4539 errmsg(
"database files are incompatible with server"),
4541 errdetail(
"The database cluster was initialized with %s %d,"
4542 " but the server was compiled with %s %d.",
4545 errhint(
"It looks like you need to recompile or initdb.")));
4549 errmsg(
"database files are incompatible with server"),
4551 errdetail(
"The database cluster was initialized with %s %d,"
4552 " but the server was compiled with %s %d.",
4555 errhint(
"It looks like you need to recompile or initdb.")));
4559 errmsg(
"database files are incompatible with server"),
4561 errdetail(
"The database cluster was initialized with %s %d,"
4562 " but the server was compiled with %s %d.",
4565 errhint(
"It looks like you need to recompile or initdb.")));
4569 errmsg(
"database files are incompatible with server"),
4571 errdetail(
"The database cluster was initialized with %s %d,"
4572 " but the server was compiled with %s %d.",
4575 errhint(
"It looks like you need to recompile or initdb.")));
4579 errmsg(
"database files are incompatible with server"),
4581 errdetail(
"The database cluster was initialized with %s %d,"
4582 " but the server was compiled with %s %d.",
4585 errhint(
"It looks like you need to recompile or initdb.")));
4589 errmsg(
"database files are incompatible with server"),
4591 errdetail(
"The database cluster was initialized with %s %d,"
4592 " but the server was compiled with %s %d.",
4595 errhint(
"It looks like you need to recompile or initdb.")));
4603 errmsg_plural(
"invalid WAL segment size in control file (%d byte)",
4604 "invalid WAL segment size in control file (%d bytes)",
4607 errdetail(
"The WAL segment size must be a power of two between 1 MB and 1 GB.")));
4617 errmsg(
"\"%s\" must be at least twice \"%s\"",
4618 "min_wal_size",
"wal_segment_size")));
4623 errmsg(
"\"%s\" must be at least twice \"%s\"",
4624 "max_wal_size",
"wal_segment_size")));
4804 "cannot set data checksums to \"on\", current state is not \"inprogress-on\", disabling");
5105 for (rmid = 0; rmid <=
RM_MAX_ID; rmid++)
5114 for (rmid = 0; rmid <=
RM_MAX_ID; rmid++)
5219 return "(disabled)";
5482 sysidentifier = ((
uint64) tv.tv_sec) << 32;
5483 sysidentifier |= ((
uint64) tv.tv_usec) << 12;
5484 sysidentifier |=
getpid() & 0xFFF;
5486 memset(&buffer, 0,
sizeof buffer);
5532 longpage->xlp_sysid = sysidentifier;
5547 *(
recptr++) =
sizeof(checkPoint);
5549 recptr +=
sizeof(checkPoint);
5577 errmsg(
"could not write bootstrap write-ahead log file: %m")));
5585 errmsg(
"could not fsync bootstrap write-ahead log file: %m")));
5591 errmsg(
"could not close bootstrap write-ahead log file: %m")));
5621 "%Y-%m-%d %H:%M:%S %Z",
5714 "recovery_end_command",
5812 errmsg(
"WAL was generated with \"wal_level=minimal\", cannot continue recovering"),
5813 errdetail(
"This happens if you temporarily set \"wal_level=minimal\" on the server."),
5814 errhint(
"Use a backup taken after setting \"wal_level\" to higher than \"minimal\".")));
5880 errmsg(
"control file contains invalid checkpoint location")));
5891 (
errmsg(
"database system was shut down at %s",
5898 (
errmsg(
"database system was shut down in recovery at %s",
5905 (
errmsg(
"database system shutdown was interrupted; last known up at %s",
5912 (
errmsg(
"database system was interrupted while in recovery at %s",
5915 errhint(
"This probably means that some data is corrupted and"
5916 " you will have to use the last backup for recovery.")));
5921 (
errmsg(
"database system was interrupted while in recovery at log time %s",
5924 errhint(
"If this has occurred more than once some data might be corrupted"
5925 " and you might need to choose an earlier recovery target.")));
5930 (
errmsg(
"database system was interrupted; last known up at %s",
5938 errmsg(
"control file contains invalid database cluster state")));
5942#ifdef XLOG_REPLAY_DELAY
6268 running.
xids = xids;
6331 errmsg(
"WAL ends before end of online backup"),
6332 errhint(
"All WAL generated while online backup was taken must be available at recovery.")));
6336 errmsg(
"WAL ends before consistent recovery point")));
6415 (
errmsg(
"archive recovery complete")));
6613 errmsg(
"enabling data checksums was interrupted"),
6614 errhint(
"Data checksum processing must be manually restarted for checksums to be enabled"));
7111 (
errmsg(
"shutting down")));
7148 static char buf[128];
7172 (
errmsg(
"restartpoint starting:%s",
7177 (
errmsg(
"checkpoint starting:%s",
7235 (
errmsg(
"restartpoint complete:%s: wrote %d buffers (%.1f%%), "
7236 "wrote %d SLRU buffers; %d WAL file(s) added, "
7237 "%d removed, %d recycled; write=%ld.%03d s, "
7238 "sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
7239 "longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
7240 "estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
7260 (
errmsg(
"checkpoint complete:%s: wrote %d buffers (%.1f%%), "
7261 "wrote %d SLRU buffers; %d WAL file(s) added, "
7262 "%d removed, %d recycled; write=%ld.%03d s, "
7263 "sync=%ld.%03d s, total=%ld.%03d s; sync files=%d, "
7264 "longest=%ld.%03d s, average=%ld.%03d s; distance=%d kB, "
7265 "estimate=%d kB; lsn=%X/%08X, redo lsn=%X/%08X",
7420 elog(
ERROR,
"can't create a checkpoint during recovery");
7458 MemSet(&checkPoint, 0,
sizeof(checkPoint));
7774 (
errmsg(
"concurrent write-ahead log activity while database system is shutting down")));
7915 elog(
ERROR,
"can only be used to end recovery");
7989 elog(
ERROR,
"can only be used at end of recovery");
7991 elog(
ERROR,
"invalid position for missing continuation record %X/%08X",
8002 elog(
ERROR,
"invalid WAL insert position %X/%08X for OVERWRITE_CONTRECORD",
8032 elog(
ERROR,
"OVERWRITE_CONTRECORD was inserted to unexpected position %X/%08X",
8101 "could not record restart point at %X/%08X because there are unresolved references to invalid pages",
8159 (
errmsg_internal(
"skipping restartpoint, recovery has already ended")));
8181 errmsg_internal(
"skipping restartpoint, already performed at %X/%08X",
8373 errmsg(
"recovery restart point at %X/%08X",
8375 xtime ?
errdetail(
"Last completed transaction was at log time %s.",
8383 "archive_cleanup_command",
8639 errmsg(
"restore point \"%s\" created at %X/%08X",
8789 Insert->fullPageWrites =
true;
8808 Insert->fullPageWrites =
false;
8893 (
errmsg(
"online backup was canceled, recovery cannot continue")));
8929 running.
xids = xids;
8947 (
errmsg(
"unexpected timeline ID %u (should be %u) in shutdown checkpoint record",
9012 (
errmsg(
"unexpected timeline ID %u (should be %u) in online checkpoint record",
9059 if (
xlrec.ThisTimeLineID != replayTLI)
9061 (
errmsg(
"unexpected timeline ID %u (should be %u) in end-of-recovery record",
9062 xlrec.ThisTimeLineID, replayTLI)));
9105 elog(
ERROR,
"XLOG_FPI record did not contain a full-page image");
9110 elog(
ERROR,
"unexpected XLogReadBufferForRedo result when restoring backup block");
9224 elog(
DEBUG1,
"update logical decoding status to %d during recovery",
9323 elog(
ERROR,
"unrecognized \"wal_sync_method\": %d", method);
9400 msg =
_(
"could not fsync file \"%s\": %m");
9402#ifdef HAVE_FSYNC_WRITETHROUGH
9405 msg =
_(
"could not fsync write-through file \"%s\": %m");
9410 msg =
_(
"could not fdatasync file \"%s\": %m");
9486 errmsg(
"WAL level not sufficient for making an online backup"),
9487 errhint(
"\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
9492 errmsg(
"backup label too long (max %d bytes)",
9607 errmsg(
"WAL generated with \"full_page_writes=off\" was replayed "
9608 "since last restartpoint"),
9609 errhint(
"This means that the backup being taken on the standby "
9610 "is corrupt and should not be used. "
9611 "Enable \"full_page_writes\" and run CHECKPOINT on the primary, "
9612 "and then try an online backup again.")));
9669 if (
de->d_name[0] <
'1' ||
de->d_name[1] >
'9')
9689 (
errmsg(
"could not read symbolic link \"%s\": %m",
9696 (
errmsg(
"symbolic link \"%s\" target is too long",
9719 if (*s ==
'\n' || *s ==
'\r' || *s ==
'\\')
9754 *tablespaces =
lappend(*tablespaces,
ti);
9816 errmsg(
"WAL level not sufficient for making an online backup"),
9817 errhint(
"\"wal_level\" must be set to \"replica\" or \"logical\" at server start.")));
9855 errmsg(
"the standby was promoted during online backup"),
9856 errhint(
"This means that the backup being taken is corrupt "
9857 "and should not be used. "
9858 "Try taking another online backup.")));
9903 errmsg(
"WAL generated with \"full_page_writes=off\" was replayed "
9904 "during online backup"),
9905 errhint(
"This means that the backup being taken on the standby "
9906 "is corrupt and should not be used. "
9907 "Enable \"full_page_writes\" and run CHECKPOINT on the primary, "
9908 "and then try an online backup again.")));
9925 sizeof(
state->startpoint));
9952 errmsg(
"could not create file \"%s\": %m",
9963 errmsg(
"could not write file \"%s\": %m",
10019 (
errmsg(
"base backup done, waiting for required WAL segments to be archived")));
10033 (
errmsg(
"still waiting for all required WAL segments to be archived (%d seconds elapsed)",
10035 errhint(
"Check that your \"archive_command\" is executing properly. "
10036 "You can safely cancel this backup, "
10037 "but the database backup will not be usable without all the WAL segments.")));
10042 (
errmsg(
"all required WAL segments have been archived")));
10046 (
errmsg(
"WAL archiving is not enabled; you must ensure that all required WAL segments are copied through other means to complete the backup")));
10085 errmsg(
"aborting backup due to backend exiting before pg_backup_stop was called"));
Datum idx(PG_FUNCTION_ARGS)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
#define pg_memory_barrier()
#define pg_read_barrier()
static uint64 pg_atomic_read_membarrier_u64(volatile pg_atomic_uint64 *ptr)
#define pg_write_barrier()
static uint64 pg_atomic_monotonic_advance_u64(volatile pg_atomic_uint64 *ptr, uint64 target)
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static void pg_atomic_write_membarrier_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
TimeLineID findNewestTimeLine(TimeLineID startTLI)
void restoreTimeLineHistoryFiles(TimeLineID begin, TimeLineID end)
void writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, XLogRecPtr switchpoint, char *reason)
void startup_progress_timeout_handler(void)
long TimestampDifferenceMilliseconds(TimestampTz start_time, TimestampTz stop_time)
bool TimestampDifferenceExceeds(TimestampTz start_time, TimestampTz stop_time, int msec)
TimestampTz GetCurrentTimestamp(void)
const char * timestamptz_to_str(TimestampTz t)
Datum now(PG_FUNCTION_ARGS)
static bool backup_started_in_recovery
void CheckPointBuffers(int flags)
void UnlockReleaseBuffer(Buffer buffer)
#define pg_attribute_unused()
#define TYPEALIGN(ALIGNVAL, LEN)
#define Assert(condition)
#define pg_attribute_always_inline
#define MemSet(start, val, len)
#define CATALOG_VERSION_NO
void WakeupCheckpointer(void)
void AbsorbSyncRequests(void)
double CheckPointCompletionTarget
void RequestCheckpoint(int flags)
@ PG_DATA_CHECKSUM_VERSION
@ PG_DATA_CHECKSUM_INPROGRESS_OFF
@ PG_DATA_CHECKSUM_INPROGRESS_ON
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
void CheckPointCLOG(void)
void StartupCommitTs(void)
void CommitTsParameterChange(bool newvalue, bool oldvalue)
bool track_commit_timestamp
void CompleteCommitTsInitialization(void)
void BootStrapCommitTs(void)
void SetCommitTsLimit(TransactionId oldestXact, TransactionId newestXact)
void CheckPointCommitTs(void)
void update_controlfile(const char *DataDir, ControlFileData *ControlFile, bool do_sync)
#define fprintf(file, fmt, msg)
void EmitAndWaitDataChecksumsBarrier(uint32 state)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errhint(const char *fmt,...) pg_attribute_printf(1
int errdetail(const char *fmt,...) pg_attribute_printf(1
int int errmsg_internal(const char *fmt,...) pg_attribute_printf(1
int int int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(1
#define ereport(elevel,...)
int MakePGDirectory(const char *directoryName)
int pg_fsync_no_writethrough(int fd)
int durable_rename(const char *oldfile, const char *newfile, int elevel)
int CloseTransientFile(int fd)
int BasicOpenFile(const char *fileName, int fileFlags)
int pg_fsync_writethrough(int fd)
void ReleaseExternalFD(void)
int data_sync_elevel(int elevel)
static void Insert(File file)
DIR * AllocateDir(const char *dirname)
int durable_unlink(const char *fname, int elevel)
void ReserveExternalFD(void)
struct dirent * ReadDir(DIR *dir, const char *dirname)
FILE * AllocateFile(const char *name, const char *mode)
int OpenTransientFile(const char *fileName, int fileFlags)
void SyncDataDirectory(void)
#define IO_DIRECT_WAL_INIT
#define palloc_object(type)
ssize_t pg_pwrite_zeros(int fd, size_t size, pgoff_t offset)
PGFileType get_dirent_type(const char *path, const struct dirent *de, bool look_through_symlinks, int elevel)
volatile uint32 CritSectionCount
bool IsPostmasterEnvironment
int set_config_option_ext(const char *name, const char *value, GucContext context, GucSource source, Oid srole, GucAction action, bool changeVal, int elevel, bool is_reload)
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
void * guc_malloc(int elevel, size_t size)
struct config_generic * find_option(const char *name, bool create_placeholders, bool skip_errors, int elevel)
#define GUC_check_errdetail
#define TOAST_MAX_CHUNK_SIZE
#define INJECTION_POINT(name, arg)
#define INJECTION_POINT_CACHED(name, arg)
#define INJECTION_POINT_LOAD(name)
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
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(List *list)
void UpdateLogicalDecodingStatusEndOfRecovery(void)
bool IsLogicalDecodingEnabled(void)
bool IsXLogLogicalInfoEnabled(void)
void StartupLogicalDecodingStatus(bool last_status)
void DisableLogicalDecoding(void)
void EnableLogicalDecoding(void)
void LWLockUpdateVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val)
void LWLockReleaseClearVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 val)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
bool LWLockWaitForVar(LWLock *lock, pg_atomic_uint64 *valptr, uint64 oldval, uint64 *newval)
void LWLockRelease(LWLock *lock)
void LWLockInitialize(LWLock *lock, int tranche_id)
bool LWLockConditionalAcquire(LWLock *lock, LWLockMode mode)
bool LWLockAcquireOrWait(LWLock *lock, LWLockMode mode)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
void MemoryContextAllowInCriticalSection(MemoryContext context, bool allow)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define AmStartupProcess()
#define IsBootstrapProcessingMode()
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define END_CRIT_SECTION()
#define AmWalReceiverProcess()
bool process_shared_preload_libraries_done
BackendType MyBackendType
void MultiXactSetNextMXact(MultiXactId nextMulti, MultiXactOffset nextMultiOffset)
void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB)
void MultiXactGetCheckptMulti(bool is_shutdown, MultiXactId *nextMulti, MultiXactOffset *nextMultiOffset, MultiXactId *oldestMulti, Oid *oldestMultiDB)
void CheckPointMultiXact(void)
void MultiXactAdvanceNextMXact(MultiXactId minMulti, MultiXactOffset minMultiOffset)
void BootStrapMultiXact(void)
void StartupMultiXact(void)
void SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
void StartupReplicationOrigin(void)
void CheckPointReplicationOrigin(void)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
#define ERRCODE_DATA_CORRUPTED
#define DEFAULT_XLOG_SEG_SIZE
#define SLRU_PAGES_PER_SEGMENT
#define PG_CACHE_LINE_SIZE
#define FLOATFORMAT_VALUE
#define XLOG_RESTORE_POINT
#define XLOG_CHECKPOINT_REDO
#define PG_CONTROL_VERSION
#define XLOG_OVERWRITE_CONTRECORD
#define XLOG_FPI_FOR_HINT
#define MOCK_AUTH_NONCE_LEN
@ DB_SHUTDOWNED_IN_RECOVERY
#define XLOG_CHECKPOINT_SHUTDOWN
#define PG_CONTROL_FILE_SIZE
#define XLOG_PARAMETER_CHANGE
#define XLOG_LOGICAL_DECODING_STATUS_CHANGE
#define XLOG_CHECKPOINT_ONLINE
#define XLOG_END_OF_RECOVERY
#define COMP_CRC32C(crc, data, len)
#define EQ_CRC32C(c1, c2)
static rewind_source * source
static char buf[DEFAULT_XLOG_SEG_SIZE]
static THREAD_BARRIER_T barrier
void pgstat_restore_stats(void)
void pgstat_discard_stats(void)
PgStat_CheckpointerStats PendingCheckpointerStats
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)
size_t pg_strftime(char *s, size_t maxsize, const char *format, const struct pg_tm *t)
struct pg_tm * pg_localtime(const pg_time_t *timep, const pg_tz *tz)
PGDLLIMPORT pg_tz * log_timezone
bool pg_strong_random(void *buf, size_t len)
int pg_strcasecmp(const char *s1, const char *s2)
size_t strlcpy(char *dst, const char *src, size_t siz)
static bool DatumGetBool(Datum X)
static Datum BoolGetDatum(bool X)
void CheckPointPredicate(void)
static int fd(const char *x, int i)
#define GetPGProcByNumber(n)
#define DELAY_CHKPT_START
#define DELAY_CHKPT_COMPLETE
bool MinimumActiveBackends(int min)
TransactionId GetOldestTransactionIdConsideredRunning(void)
bool HaveVirtualXIDsDelayingChkpt(VirtualTransactionId *vxids, int nvxids, int type)
void ProcArrayApplyRecoveryInfo(RunningTransactions running)
TransactionId GetOldestActiveTransactionId(bool inCommitOnly, bool allDbs)
void ProcArrayInitRecovery(TransactionId initializedUptoXID)
VirtualTransactionId * GetVirtualXIDsDelayingChkpt(int *nvxids, int type)
#define INVALID_PROC_NUMBER
void WaitForProcSignalBarrier(uint64 generation)
uint64 EmitProcSignalBarrier(ProcSignalBarrierType type)
@ PROCSIGNAL_BARRIER_CHECKSUM_INPROGRESS_OFF
@ PROCSIGNAL_BARRIER_CHECKSUM_INPROGRESS_ON
@ PROCSIGNAL_BARRIER_CHECKSUM_ON
@ PROCSIGNAL_BARRIER_CHECKSUM_OFF
static void set_ps_display(const char *activity)
void ResetUnloggedRelations(int op)
#define UNLOGGED_RELATION_INIT
#define UNLOGGED_RELATION_CLEANUP
void RelationCacheInitFileRemove(void)
void CheckPointRelationMap(void)
#define relpath(rlocator, forknum)
void StartupReorderBuffer(void)
ResourceOwner CurrentResourceOwner
ResourceOwner AuxProcessResourceOwner
void CheckPointLogicalRewriteHeap(void)
Size add_size(Size s1, Size s2)
Size mul_size(Size s1, Size s2)
#define ShmemRequestStruct(...)
void pg_usleep(long microsec)
void CheckPointReplicationSlots(bool is_shutdown)
void StartupReplicationSlots(void)
bool InvalidateObsoleteReplicationSlots(uint32 possible_causes, XLogSegNo oldestSegno, Oid dboid, TransactionId snapshotConflictHorizon)
bool sync_replication_slots
void smgrdestroyall(void)
void CheckPointSnapBuild(void)
void DeleteAllExportedSnapshotFiles(void)
static void SpinLockRelease(volatile slock_t *lock)
static void SpinLockAcquire(volatile slock_t *lock)
static void SpinLockInit(volatile slock_t *lock)
void InitRecoveryTransactionEnvironment(void)
XLogRecPtr LogStandbySnapshot(Oid dbid)
void ShutdownRecoveryTransactionEnvironment(void)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendBinaryStringInfo(StringInfo str, const void *data, int datalen)
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
TransactionId oldestActiveXid
FullTransactionId nextXid
TransactionId oldestCommitTsXid
bool logicalDecodingEnabled
uint64 ckpt_agg_sync_time
TimestampTz ckpt_sync_end_t
char mock_authentication_nonce[MOCK_AUTH_NONCE_LEN]
uint32 pg_control_version
XLogRecPtr backupStartPoint
bool track_commit_timestamp
CheckPoint checkPointCopy
uint32 slru_pages_per_segment
XLogRecPtr backupEndPoint
XLogRecPtr minRecoveryPoint
uint32 data_checksum_version
bool default_char_signedness
uint32 catalog_version_no
TimeLineID minRecoveryPointTLI
uint32 toast_max_chunk_size
PgStat_Counter write_time
void(* rm_mask)(char *pagedata, BlockNumber blkno)
TransactionId oldestRunningXid
TransactionId latestCompletedXid
subxids_array_status subxid_status
ShmemRequestCallback request_fn
TransactionId oldestCommitTsXid
TransactionId newestCommitTsXid
FullTransactionId latestCompletedXid
FullTransactionId nextXid
pg_atomic_uint64 insertingAt
XLogRecPtr lastImportantAt
pg_atomic_uint64 minWaitedLSN[WAIT_LSN_TYPE_COUNT]
CheckPoint lastCheckPoint
XLogRecPtr InitializedUpTo
pg_time_t lastSegSwitchTime
XLogRecPtr replicationSlotMinLSN
RecoveryState SharedRecoveryState
uint32 data_checksum_version
TimeLineID InsertTimeLineID
XLogRecPtr lastSegSwitchLSN
XLogSegNo lastRemovedSegNo
pg_atomic_uint64 * xlblocks
pg_atomic_uint64 logWriteResult
XLogRecPtr lastCheckPointRecPtr
XLogRecPtr lastFpwDisableRecPtr
bool InstallXLogFileSegmentActive
XLogRecPtr lastCheckPointEndPtr
pg_atomic_uint64 logFlushResult
pg_atomic_uint64 logInsertResult
TimeLineID PrevTimeLineID
pg_atomic_uint64 unloggedLSN
WALInsertLockPadded * WALInsertLocks
char pad[PG_CACHE_LINE_SIZE]
XLogRecPtr lastBackupStart
ChecksumStateType new_checksum_state
void StartupSUBTRANS(TransactionId oldestActiveXID)
void CheckPointSUBTRANS(void)
void BootStrapSUBTRANS(void)
void TruncateSUBTRANS(TransactionId oldestXact)
void ProcessSyncRequests(void)
void SyncPreCheckpoint(void)
void SyncPostCheckpoint(void)
TimeoutId RegisterTimeout(TimeoutId id, timeout_handler_proc handler)
@ STARTUP_PROGRESS_TIMEOUT
#define TransactionIdRetreat(dest)
#define InvalidTransactionId
static void FullTransactionIdRetreat(FullTransactionId *dest)
#define XidFromFullTransactionId(x)
#define FirstGenbkiObjectId
#define FirstNormalTransactionId
#define TransactionIdIsValid(xid)
static FullTransactionId FullTransactionIdFromEpochAndXid(uint32 epoch, TransactionId xid)
#define TransactionIdIsNormal(xid)
#define FullTransactionIdPrecedes(a, b)
static bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
void RecoverPreparedTransactions(void)
void restoreTwoPhaseData(void)
TransactionId PrescanPreparedTransactions(TransactionId **xids_p, int *nxids_p)
void StandbyRecoverPreparedTransactions(void)
void CheckPointTwoPhase(XLogRecPtr redo_horizon)
char pad[PG_CACHE_LINE_SIZE]
bool SplitIdentifierString(char *rawstring, char separator, List **namelist)
void SetTransactionIdLimit(TransactionId oldest_datfrozenxid, Oid oldest_datoid)
void AdvanceOldestClogXid(TransactionId oldest_datfrozenxid)
TransamVariablesData * TransamVariables
static void pgstat_report_wait_start(uint32 wait_event_info)
static void pgstat_report_wait_end(void)
#define WL_EXIT_ON_PM_DEATH
static TimestampTz wakeup[NUM_WALRCV_WAKEUPS]
XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI)
void ShutdownWalRcv(void)
void WalSndWakeup(bool physical, bool logical)
void WalSndInitStopping(void)
void WalSndWaitStopping(void)
static void WalSndWakeupProcessRequests(bool physical, bool logical)
#define WalSndWakeupRequest()
void WaitForWalSummarization(XLogRecPtr lsn)
void WakeupWalSummarizer(void)
XLogRecPtr GetOldestUnsummarizedLSN(TimeLineID *tli, bool *lsn_is_exact)
#define readlink(path, buf, size)
int gettimeofday(struct timeval *tp, void *tzp)
void MarkSubxactTopXidLogged(void)
void MarkCurrentTransactionIdLoggedIfAny(void)
int XLogFileInit(XLogSegNo logsegno, TimeLineID logtli)
void assign_wal_sync_method(int new_wal_sync_method, void *extra)
static const char * CheckpointFlagsString(int flags)
static void CreateEndOfRecoveryRecord(void)
uint64 GetSystemIdentifier(void)
int wal_decode_buffer_size
XLogRecPtr ProcLastRecPtr
static XLogCtlData * XLogCtl
void UpdateFullPageWrites(void)
bool RecoveryInProgress(void)
static void CleanupBackupHistory(void)
void GetFullPageWriteInfo(XLogRecPtr *RedoRecPtr_p, bool *doPageWrites_p)
TimeLineID GetWALInsertionTimeLine(void)
static ControlFileData * LocalControlFile
XLogRecPtr RequestXLogSwitch(bool mark_unimportant)
void do_pg_abort_backup(int code, Datum arg)
XLogSegNo XLogGetLastRemovedSegno(void)
XLogRecPtr XLogInsertRecord(XLogRecData *rdata, XLogRecPtr fpw_lsn, uint8 flags, int num_fpi, uint64 fpi_bytes, bool topxid_included)
void SetLocalDataChecksumState(uint32 data_checksum_version)
char * XLogArchiveCommand
Size WALReadFromBuffers(char *dstbuf, XLogRecPtr startptr, Size count, TimeLineID tli)
static XLogRecPtr WaitXLogInsertionsToFinish(XLogRecPtr upto)
static void WALInsertLockRelease(void)
void SetDataChecksumsOff(void)
static XLogRecPtr XLogBytePosToRecPtr(uint64 bytepos)
static void WALInsertLockUpdateInsertingAt(XLogRecPtr insertingAt)
XLogRecPtr GetRedoRecPtr(void)
void assign_wal_consistency_checking(const char *newval, void *extra)
static void InitControlFile(uint64 sysidentifier, uint32 data_checksum_version)
void SetInstallXLogFileSegmentActive(void)
static void AdvanceXLInsertBuffer(XLogRecPtr upto, TimeLineID tli, bool opportunistic)
static void WALInsertLockAcquireExclusive(void)
static void UpdateControlFile(void)
bool IsInstallXLogFileSegmentActive(void)
void BootStrapXLOG(uint32 data_checksum_version)
XLogRecPtr XactLastRecEnd
bool CreateRestartPoint(int flags)
static void ValidateXLOGDirectoryStructure(void)
static void RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr lastredoptr, XLogRecPtr endptr, TimeLineID insertTLI)
static XLogRecPtr CreateOverwriteContrecordRecord(XLogRecPtr aborted_lsn, XLogRecPtr pagePtr, TimeLineID newTLI)
void xlog2_redo(XLogReaderState *record)
XLogRecPtr GetInsertRecPtr(void)
static void CalculateCheckpointSegments(void)
XLogRecPtr XLogGetReplicationSlotMinimumLSN(void)
SessionBackupState get_backup_status(void)
static void XLogReportParameters(void)
#define RefreshXLogWriteResult(_target)
void CheckXLogRemoved(XLogSegNo segno, TimeLineID tli)
static void LogCheckpointStart(int flags, bool restartpoint)
static XLogRecPtr RedoRecPtr
void assign_checkpoint_completion_target(double newval, void *extra)
static bool InstallXLogFileSegment(XLogSegNo *segno, char *tmppath, bool find_free, XLogSegNo max_segno, TimeLineID tli)
static void WriteControlFile(void)
WALAvailability GetWALAvailability(XLogRecPtr targetLSN)
const char * show_archive_command(void)
#define UsableBytesInPage
const ShmemCallbacks XLOGShmemCallbacks
void ShutdownXLOG(int code, Datum arg)
static bool PerformRecoveryXLogAction(void)
RecoveryState GetRecoveryState(void)
static void CleanupAfterArchiveRecovery(TimeLineID EndOfLogTLI, XLogRecPtr EndOfLog, TimeLineID newTLI)
#define ConvertToXSegs(x, segsize)
static void RemoveXlogFile(const struct dirent *segment_de, XLogSegNo recycleSegNo, XLogSegNo *endlogSegNo, TimeLineID insertTLI)
pg_time_t GetLastSegSwitchData(XLogRecPtr *lastSwitchLSN)
const char * show_effective_wal_level(void)
static int XLOGChooseNumBuffers(void)
static XLogRecPtr XLogBytePosToEndRecPtr(uint64 bytepos)
static void LogCheckpointEnd(bool restartpoint, int flags)
static int get_sync_bit(int method)
static XLogwrtResult LogwrtResult
void XLogSetReplicationSlotMinimumLSN(XLogRecPtr lsn)
void SwitchIntoArchiveRecovery(XLogRecPtr EndRecPtr, TimeLineID replayTLI)
static bool lastFullPageWrites
char * wal_consistency_checking_string
bool DataChecksumsNeedVerify(void)
static void WALInsertLockAcquire(void)
void SetDataChecksumsOn(void)
static void CopyXLogRecordToWAL(int write_len, bool isLogSwitch, XLogRecData *rdata, XLogRecPtr StartPos, XLogRecPtr EndPos, TimeLineID tli)
bool GetDefaultCharSignedness(void)
static double CheckPointDistanceEstimate
static uint64 XLogRecPtrToBytePos(XLogRecPtr ptr)
const char * show_in_hot_standby(void)
XLogRecPtr GetXLogInsertRecPtr(void)
void SetWalWriterSleeping(bool sleeping)
static void XLogInitNewTimeline(TimeLineID endTLI, XLogRecPtr endOfLog, TimeLineID newTLI)
static void CheckRequiredParameterValues(void)
#define XLogRecPtrToBufIdx(recptr)
void SetDataChecksumsOnInProgress(void)
int XLogFileOpen(XLogSegNo segno, TimeLineID tli)
int max_slot_wal_keep_size_mb
XLogRecPtr GetFlushRecPtr(TimeLineID *insertTLI)
static void PreallocXlogFiles(XLogRecPtr endptr, TimeLineID tli)
static bool holdingAllLocks
static TimeLineID openLogTLI
XLogRecPtr XactLastCommitEnd
WalLevel GetActiveWalLevelOnStandby(void)
static void KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
static void XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible)
static void XLogChecksums(uint32 new_type)
void InitializeWalConsistencyChecking(void)
static void UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force)
static int LocalSetXLogInsertAllowed(void)
void assign_max_wal_size(int newval, void *extra)
void RemoveNonParentXlogFiles(XLogRecPtr switchpoint, TimeLineID newTLI)
XLogRecPtr GetLastImportantRecPtr(void)
void xlog_redo(XLogReaderState *record)
static void RecoveryRestartPoint(const CheckPoint *checkPoint, XLogReaderState *record)
bool XLogNeedsFlush(XLogRecPtr record)
void register_persistent_abort_backup_handler(void)
static double PrevCheckPointDistance
void ReachedEndOfBackup(XLogRecPtr EndRecPtr, TimeLineID tli)
void LocalProcessControlFile(bool reset)
static void XLOGShmemInit(void *arg)
static void XLogFileClose(void)
static void UpdateCheckPointDistanceEstimate(uint64 nbytes)
static bool LocalRecoveryInProgress
XLogSegNo XLogGetOldestSegno(TimeLineID tli)
XLogRecPtr GetXLogWriteRecPtr(void)
static void XLOGShmemAttach(void *arg)
void ResetInstallXLogFileSegmentActive(void)
static WALInsertLockPadded * WALInsertLocks
static XLogSegNo openLogSegNo
#define INSERT_FREESPACE(endptr)
int wal_retrieve_retry_interval
bool XLogBackgroundFlush(void)
const struct config_enum_entry archive_mode_options[]
void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli)
char * GetMockAuthenticationNonce(void)
static XLogSegNo XLOGfileslop(XLogRecPtr lastredoptr)
static int UsableBytesInSegment
const char * show_data_checksums(void)
static char * GetXLogBuffer(XLogRecPtr ptr, TimeLineID tli)
bool DataChecksumsInProgressOn(void)
@ WALINSERT_SPECIAL_SWITCH
@ WALINSERT_SPECIAL_CHECKPOINT
bool XLogInsertAllowed(void)
void do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces, BackupState *state, StringInfo tblspcmapfile)
static ControlFileData * ControlFile
bool check_wal_segment_size(int *newval, void **extra, GucSource source)
static void XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno, TimeLineID srcTLI, XLogSegNo srcsegno, int upto)
static int LocalXLogInsertAllowed
static void RemoveTempXlogFiles(void)
XLogRecPtr XLogRestorePoint(const char *rpName)
static XLogRecPtr LocalMinRecoveryPoint
#define NUM_XLOGINSERT_LOCKS
TimeLineID GetWALInsertionTimeLineIfSet(void)
void do_pg_backup_stop(BackupState *state, bool waitforarchive)
bool check_wal_consistency_checking(char **newval, void **extra, GucSource source)
const struct config_enum_entry wal_sync_method_options[]
bool CreateCheckPoint(int flags)
#define BootstrapTimeLineID
bool DataChecksumsNeedWrite(void)
CheckpointStatsData CheckpointStats
bool check_wal_buffers(int *newval, void **extra, GucSource source)
XLogRecPtr GetFakeLSNForUnloggedRel(void)
static char * str_time(pg_time_t tnow, char *buf, size_t bufsize)
XLogRecPtr GetXLogInsertEndRecPtr(void)
void XLogPutNextOid(Oid nextOid)
static ChecksumStateType LocalDataChecksumState
void XLogFlush(XLogRecPtr record)
static void ReadControlFile(void)
static SessionBackupState sessionBackupState
XLogRecPtr XLogAssignLSN(void)
void InitLocalDataChecksumState(void)
static void CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
static bool updateMinRecoveryPoint
static void XLOGShmemRequest(void *arg)
static bool check_wal_consistency_checking_deferred
static void ReserveXLogInsertLocation(int size, XLogRecPtr *StartPos, XLogRecPtr *EndPos, XLogRecPtr *PrevPtr)
void XLogShutdownWalRcv(void)
static void UpdateLastRemovedPtr(char *filename)
static TimeLineID LocalMinRecoveryPointTLI
void issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
static bool ReserveXLogSwitch(XLogRecPtr *StartPos, XLogRecPtr *EndPos, XLogRecPtr *PrevPtr)
void XLogSetAsyncXactLSN(XLogRecPtr asyncXactLSN)
bool XLogCheckpointNeeded(XLogSegNo new_segno)
bool * wal_consistency_checking
static int XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli, bool *added, char *path)
static void update_checkpoint_display(int flags, bool restartpoint, bool reset)
#define XLogArchivingActive()
#define TABLESPACE_MAP_OLD
#define XLOG_MARK_UNIMPORTANT
#define CHECKPOINT_FLUSH_UNLOGGED
#define XLogLogicalInfoActive()
#define STANDBY_SIGNAL_FILE
#define CHECKPOINT_CAUSE_XLOG
#define CHECKPOINT_END_OF_RECOVERY
#define BACKUP_LABEL_FILE
#define CHECKPOINT_CAUSE_TIME
#define RECOVERY_SIGNAL_FILE
#define CHECKPOINT_IS_SHUTDOWN
#define XLogArchivingAlways()
@ WAL_SYNC_METHOD_FDATASYNC
@ WAL_SYNC_METHOD_FSYNC_WRITETHROUGH
@ WAL_SYNC_METHOD_OPEN_DSYNC
#define XLogStandbyInfoActive()
#define XLP_FIRST_IS_CONTRECORD
static RmgrData GetRmgr(RmgrId rmid)
#define IsValidWalSegSize(size)
XLogLongPageHeaderData * XLogLongPageHeader
#define XLP_FIRST_IS_OVERWRITE_CONTRECORD
#define XLOG_CONTROL_FILE
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
static bool IsXLogFileName(const char *fname)
static void XLogFromFileName(const char *fname, TimeLineID *tli, XLogSegNo *logSegNo, int wal_segsz_bytes)
#define XLByteToPrevSeg(xlrp, logSegNo, wal_segsz_bytes)
#define XLogSegNoOffsetToRecPtr(segno, offset, wal_segsz_bytes, dest)
XLogPageHeaderData * XLogPageHeader
static bool IsBackupHistoryFileName(const char *fname)
#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes)
static void BackupHistoryFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes)
static void XLogFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
#define XRecOffIsValid(xlrp)
#define SizeOfXLogShortPHD
#define SizeOfXLogLongPHD
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
static void BackupHistoryFilePath(char *path, TimeLineID tli, XLogSegNo logSegNo, XLogRecPtr startpoint, int wal_segsz_bytes)
static bool RmgrIdExists(RmgrId rmid)
#define XLByteInPrevSeg(xlrp, logSegNo, wal_segsz_bytes)
static bool IsPartialXLogFileName(const char *fname)
bool XLogArchiveIsReadyOrDone(const char *xlog)
bool XLogArchiveIsBusy(const char *xlog)
bool XLogArchiveIsReady(const char *xlog)
void XLogArchiveNotifySeg(XLogSegNo segno, TimeLineID tli)
void ExecuteRecoveryCommand(const char *command, const char *commandName, bool failOnSignal, uint32 wait_event_info)
bool XLogArchiveCheckDone(const char *xlog)
void XLogArchiveNotify(const char *xlog)
void XLogArchiveCleanup(const char *xlog)
char * build_backup_content(BackupState *state, bool ishistoryfile)
#define XLogRecPtrIsValid(r)
#define LSN_FORMAT_ARGS(lsn)
#define FirstNormalUnloggedLSN
#define InvalidXLogRecPtr
#define DEFAULT_WAL_SYNC_METHOD
const char * get_checksum_state_string(uint32 state)
XLogRecPtr XLogInsert(RmgrId rmid, uint8 info)
void XLogRegisterData(const void *data, uint32 len)
void XLogSetRecordFlags(uint8 flags)
void XLogBeginInsert(void)
XLogReaderState * XLogReaderAllocate(int wal_segment_size, const char *waldir, XLogReaderRoutine *routine, void *private_data)
bool DecodeXLogRecord(XLogReaderState *state, DecodedXLogRecord *decoded, XLogRecord *record, XLogRecPtr lsn, char **errormsg)
size_t DecodeXLogRecordRequiredSpace(size_t xl_tot_len)
#define XLogRecGetInfo(decoder)
#define XLogRecGetData(decoder)
#define XLogRecMaxBlockId(decoder)
#define XLogRecHasBlockImage(decoder, block_id)
#define XLogRecHasAnyBlockRefs(decoder)
#define SizeOfXLogRecordDataHeaderShort
#define XLR_BLOCK_ID_DATA_SHORT
void ShutdownWalRecovery(void)
bool ArchiveRecoveryRequested
void RecoveryRequiresIntParameter(const char *param_name, int currValue, int minValue)
void PerformWalRecovery(void)
char * archiveCleanupCommand
XLogRecPtr GetCurrentReplayRecPtr(TimeLineID *replayEndTLI)
void xlog_outdesc(StringInfo buf, XLogReaderState *record)
bool PromoteIsTriggered(void)
static XLogRecPtr missingContrecPtr
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
static XLogRecPtr abortedRecPtr
EndOfWalRecoveryInfo * FinishWalRecovery(void)
void InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr, bool *haveBackupLabel_ptr, bool *haveTblspcMap_ptr)
char * recoveryEndCommand
TimeLineID recoveryTargetTLI
TimestampTz GetLatestXTime(void)
bool XLogHaveInvalidPages(void)
XLogRedoAction XLogReadBufferForRedo(XLogReaderState *record, uint8 block_id, Buffer *buf)
HotStandbyState standbyState
struct WaitLSNState * waitLSNState
void WaitLSNWakeup(WaitLSNType lsnType, XLogRecPtr currentLSN)
@ WAIT_LSN_TYPE_PRIMARY_FLUSH
@ WAIT_LSN_TYPE_STANDBY_REPLAY
@ WAIT_LSN_TYPE_STANDBY_FLUSH
@ WAIT_LSN_TYPE_STANDBY_WRITE