1/*-------------------------------------------------------------------------
4 * Internal routines for base backups.
6 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
7 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/backend/access/transam/xlogbackup.c
11 *-------------------------------------------------------------------------
21 * Build contents for backup_label or backup history file.
23 * When ishistoryfile is true, it creates the contents for a backup history
24 * file, otherwise it creates contents for a backup_label file.
26 * Returns the result generated as a palloc'd string.
31 char startstrbuf[128];
32 char startxlogfile[
MAXFNAMELEN];
/* backup start WAL file */
39 /* Use the log timezone here, not the session timezone */
40 pg_strftime(startstrbuf,
sizeof(startstrbuf),
"%Y-%m-%d %H:%M:%S %Z",
50 char stopxlogfile[
MAXFNAMELEN];
/* backup stop WAL file */
63 state->started_in_recovery ?
"standby" :
"primary");
70 char stopstrfbuf[128];
72 /* Use the log timezone here, not the session timezone */
73 pg_strftime(stopstrfbuf,
sizeof(stopstrfbuf),
"%Y-%m-%d %H:%M:%S %Z",
80 /* either both istartpoint and istarttli should be set, or neither */
Assert(PointerIsAligned(start, uint64))
void pfree(void *pointer)
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
StringInfo makeStringInfo(void)
void appendStringInfo(StringInfo str, const char *fmt,...)
void appendStringInfoString(StringInfo str, const char *s)
#define XLByteToSeg(xlrp, logSegNo, wal_segsz_bytes)
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
char * build_backup_content(BackupState *state, bool ishistoryfile)
#define LSN_FORMAT_ARGS(lsn)
#define XLogRecPtrIsInvalid(r)