PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
timeline.c File Reference
#include "postgres.h"
#include <sys/stat.h>
#include <unistd.h>
#include "access/timeline.h"
#include "access/xlog.h"
#include "access/xlog_internal.h"
#include "access/xlogdefs.h"
#include "pgstat.h"
#include "storage/fd.h"
Include dependency graph for timeline.c:

Go to the source code of this file.

Functions

void restoreTimeLineHistoryFiles (TimeLineID begin, TimeLineID end)
 
ListreadTimeLineHistory (TimeLineID targetTLI)
 
bool existsTimeLineHistory (TimeLineID probeTLI)
 
TimeLineID findNewestTimeLine (TimeLineID startTLI)
 
void writeTimeLineHistory (TimeLineID newTLI, TimeLineID parentTLI, XLogRecPtr switchpoint, char *reason)
 
void writeTimeLineHistoryFile (TimeLineID tli, char *content, int size)
 
bool tliInHistory (TimeLineID tli, List *expectedTLEs)
 
TimeLineID tliOfPointInHistory (XLogRecPtr ptr, List *history)
 
XLogRecPtr tliSwitchPoint (TimeLineID tli, List *history, TimeLineID *nextTLI)
 

Function Documentation

bool existsTimeLineHistory ( TimeLineID  probeTLI)

Definition at line 207 of file timeline.c.

References AllocateFile(), ArchiveRecoveryRequested, ereport, errcode_for_file_access(), errmsg(), FATAL, fd(), FreeFile(), MAXFNAMELEN, MAXPGPATH, NULL, RestoreArchivedFile(), TLHistoryFileName, and TLHistoryFilePath.

Referenced by findNewestTimeLine(), readRecoveryCommandFile(), and WalRcvFetchTimeLineHistoryFiles().

208 {
209  char path[MAXPGPATH];
210  char histfname[MAXFNAMELEN];
211  FILE *fd;
212 
213  /* Timeline 1 does not have a history file, so no need to check */
214  if (probeTLI == 1)
215  return false;
216 
218  {
219  TLHistoryFileName(histfname, probeTLI);
220  RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false);
221  }
222  else
223  TLHistoryFilePath(path, probeTLI);
224 
225  fd = AllocateFile(path, "r");
226  if (fd != NULL)
227  {
228  FreeFile(fd);
229  return true;
230  }
231  else
232  {
233  if (errno != ENOENT)
234  ereport(FATAL,
236  errmsg("could not open file \"%s\": %m", path)));
237  return false;
238  }
239 }
bool ArchiveRecoveryRequested
Definition: xlog.c:246
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:51
static int fd(const char *x, int i)
Definition: preproc-init.c:105
#define FATAL
Definition: elog.h:52
#define MAXPGPATH
#define TLHistoryFileName(fname, tli)
int errcode_for_file_access(void)
Definition: elog.c:598
FILE * AllocateFile(const char *name, const char *mode)
Definition: fd.c:2057
#define ereport(elevel, rest)
Definition: elog.h:122
#define MAXFNAMELEN
#define NULL
Definition: c.h:229
int FreeFile(FILE *file)
Definition: fd.c:2240
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define TLHistoryFilePath(path, tli)
TimeLineID findNewestTimeLine ( TimeLineID  startTLI)

Definition at line 249 of file timeline.c.

References existsTimeLineHistory().

Referenced by readRecoveryCommandFile(), rescanLatestTimeLine(), and StartupXLOG().

250 {
251  TimeLineID newestTLI;
252  TimeLineID probeTLI;
253 
254  /*
255  * The algorithm is just to probe for the existence of timeline history
256  * files. XXX is it useful to allow gaps in the sequence?
257  */
258  newestTLI = startTLI;
259 
260  for (probeTLI = startTLI + 1;; probeTLI++)
261  {
262  if (existsTimeLineHistory(probeTLI))
263  {
264  newestTLI = probeTLI; /* probeTLI exists */
265  }
266  else
267  {
268  /* doesn't exist, assume we're done */
269  break;
270  }
271  }
272 
273  return newestTLI;
274 }
uint32 TimeLineID
Definition: xlogdefs.h:45
bool existsTimeLineHistory(TimeLineID probeTLI)
Definition: timeline.c:207
List* readTimeLineHistory ( TimeLineID  targetTLI)

Definition at line 75 of file timeline.c.

References AllocateFile(), ArchiveRecoveryRequested, TimeLineHistoryEntry::begin, TimeLineHistoryEntry::end, ereport, errcode_for_file_access(), errhint(), errmsg(), FATAL, fd(), FreeFile(), InvalidXLogRecPtr, KeepFileRestoredFromArchive(), lcons(), list_make1, MAXFNAMELEN, MAXPGPATH, NIL, NULL, palloc(), RestoreArchivedFile(), TLHistoryFileName, TLHistoryFilePath, and TimeLineHistoryEntry::tli.

Referenced by rescanLatestTimeLine(), StartReplication(), WaitForWALToBecomeAvailable(), XLogFileReadAnyTLI(), XLogReadDetermineTimeline(), and XLogSendPhysical().

76 {
77  List *result;
78  char path[MAXPGPATH];
79  char histfname[MAXFNAMELEN];
80  char fline[MAXPGPATH];
81  FILE *fd;
82  TimeLineHistoryEntry *entry;
83  TimeLineID lasttli = 0;
84  XLogRecPtr prevend;
85  bool fromArchive = false;
86 
87  /* Timeline 1 does not have a history file, so no need to check */
88  if (targetTLI == 1)
89  {
91  entry->tli = targetTLI;
92  entry->begin = entry->end = InvalidXLogRecPtr;
93  return list_make1(entry);
94  }
95 
97  {
98  TLHistoryFileName(histfname, targetTLI);
99  fromArchive =
100  RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false);
101  }
102  else
103  TLHistoryFilePath(path, targetTLI);
104 
105  fd = AllocateFile(path, "r");
106  if (fd == NULL)
107  {
108  if (errno != ENOENT)
109  ereport(FATAL,
111  errmsg("could not open file \"%s\": %m", path)));
112  /* Not there, so assume no parents */
113  entry = (TimeLineHistoryEntry *) palloc(sizeof(TimeLineHistoryEntry));
114  entry->tli = targetTLI;
115  entry->begin = entry->end = InvalidXLogRecPtr;
116  return list_make1(entry);
117  }
118 
119  result = NIL;
120 
121  /*
122  * Parse the file...
123  */
124  prevend = InvalidXLogRecPtr;
125  while (fgets(fline, sizeof(fline), fd) != NULL)
126  {
127  /* skip leading whitespace and check for # comment */
128  char *ptr;
129  TimeLineID tli;
130  uint32 switchpoint_hi;
131  uint32 switchpoint_lo;
132  int nfields;
133 
134  for (ptr = fline; *ptr; ptr++)
135  {
136  if (!isspace((unsigned char) *ptr))
137  break;
138  }
139  if (*ptr == '\0' || *ptr == '#')
140  continue;
141 
142  nfields = sscanf(fline, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo);
143 
144  if (nfields < 1)
145  {
146  /* expect a numeric timeline ID as first field of line */
147  ereport(FATAL,
148  (errmsg("syntax error in history file: %s", fline),
149  errhint("Expected a numeric timeline ID.")));
150  }
151  if (nfields != 3)
152  ereport(FATAL,
153  (errmsg("syntax error in history file: %s", fline),
154  errhint("Expected a transaction log switchpoint location.")));
155 
156  if (result && tli <= lasttli)
157  ereport(FATAL,
158  (errmsg("invalid data in history file: %s", fline),
159  errhint("Timeline IDs must be in increasing sequence.")));
160 
161  lasttli = tli;
162 
163  entry = (TimeLineHistoryEntry *) palloc(sizeof(TimeLineHistoryEntry));
164  entry->tli = tli;
165  entry->begin = prevend;
166  entry->end = ((uint64) (switchpoint_hi)) << 32 | (uint64) switchpoint_lo;
167  prevend = entry->end;
168 
169  /* Build list with newest item first */
170  result = lcons(entry, result);
171 
172  /* we ignore the remainder of each line */
173  }
174 
175  FreeFile(fd);
176 
177  if (result && targetTLI <= lasttli)
178  ereport(FATAL,
179  (errmsg("invalid data in history file \"%s\"", path),
180  errhint("Timeline IDs must be less than child timeline's ID.")));
181 
182  /*
183  * Create one more entry for the "tip" of the timeline, which has no entry
184  * in the history file.
185  */
186  entry = (TimeLineHistoryEntry *) palloc(sizeof(TimeLineHistoryEntry));
187  entry->tli = targetTLI;
188  entry->begin = prevend;
189  entry->end = InvalidXLogRecPtr;
190 
191  result = lcons(entry, result);
192 
193  /*
194  * If the history file was fetched from archive, save it in pg_wal for
195  * future reference.
196  */
197  if (fromArchive)
198  KeepFileRestoredFromArchive(path, histfname);
199 
200  return result;
201 }
bool ArchiveRecoveryRequested
Definition: xlog.c:246
#define NIL
Definition: pg_list.h:69
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
int errhint(const char *fmt,...)
Definition: elog.c:987
uint32 TimeLineID
Definition: xlogdefs.h:45
void KeepFileRestoredFromArchive(char *path, char *xlogfname)
Definition: xlogarchive.c:426
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:51
TimeLineID tli
Definition: timeline.h:27
static int fd(const char *x, int i)
Definition: preproc-init.c:105
#define list_make1(x1)
Definition: pg_list.h:133
#define FATAL
Definition: elog.h:52
#define MAXPGPATH
#define TLHistoryFileName(fname, tli)
int errcode_for_file_access(void)
Definition: elog.c:598
FILE * AllocateFile(const char *name, const char *mode)
Definition: fd.c:2057
unsigned int uint32
Definition: c.h:268
#define ereport(elevel, rest)
Definition: elog.h:122
#define MAXFNAMELEN
List * lcons(void *datum, List *list)
Definition: list.c:259
#define NULL
Definition: c.h:229
XLogRecPtr end
Definition: timeline.h:29
uint64 XLogRecPtr
Definition: xlogdefs.h:21
int FreeFile(FILE *file)
Definition: fd.c:2240
void * palloc(Size size)
Definition: mcxt.c:849
int errmsg(const char *fmt,...)
Definition: elog.c:797
XLogRecPtr begin
Definition: timeline.h:28
Definition: pg_list.h:45
#define TLHistoryFilePath(path, tli)
void restoreTimeLineHistoryFiles ( TimeLineID  begin,
TimeLineID  end 
)

Definition at line 49 of file timeline.c.

References KeepFileRestoredFromArchive(), MAXFNAMELEN, MAXPGPATH, RestoreArchivedFile(), and TLHistoryFileName.

Referenced by rescanLatestTimeLine(), and StartupXLOG().

50 {
51  char path[MAXPGPATH];
52  char histfname[MAXFNAMELEN];
53  TimeLineID tli;
54 
55  for (tli = begin; tli < end; tli++)
56  {
57  if (tli == 1)
58  continue;
59 
60  TLHistoryFileName(histfname, tli);
61  if (RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false))
62  KeepFileRestoredFromArchive(path, histfname);
63  }
64 }
uint32 TimeLineID
Definition: xlogdefs.h:45
void KeepFileRestoredFromArchive(char *path, char *xlogfname)
Definition: xlogarchive.c:426
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:51
#define MAXPGPATH
#define TLHistoryFileName(fname, tli)
#define MAXFNAMELEN
bool tliInHistory ( TimeLineID  tli,
List expectedTLEs 
)

Definition at line 517 of file timeline.c.

References lfirst.

Referenced by checkTimeLineSwitch(), and ReadRecord().

518 {
519  ListCell *cell;
520 
521  foreach(cell, expectedTLEs)
522  {
523  if (((TimeLineHistoryEntry *) lfirst(cell))->tli == tli)
524  return true;
525  }
526 
527  return false;
528 }
#define lfirst(lc)
Definition: pg_list.h:106
TimeLineID tliOfPointInHistory ( XLogRecPtr  ptr,
List history 
)

Definition at line 535 of file timeline.c.

References TimeLineHistoryEntry::begin, elog, TimeLineHistoryEntry::end, ERROR, lfirst, TimeLineHistoryEntry::tli, and XLogRecPtrIsInvalid.

Referenced by StartupXLOG(), WaitForWALToBecomeAvailable(), and XLogReadDetermineTimeline().

536 {
537  ListCell *cell;
538 
539  foreach(cell, history)
540  {
542 
543  if ((XLogRecPtrIsInvalid(tle->begin) || tle->begin <= ptr) &&
544  (XLogRecPtrIsInvalid(tle->end) || ptr < tle->end))
545  {
546  /* found it */
547  return tle->tli;
548  }
549  }
550 
551  /* shouldn't happen. */
552  elog(ERROR, "timeline history was not contiguous");
553  return 0; /* keep compiler quiet */
554 }
TimeLineID tli
Definition: timeline.h:27
#define ERROR
Definition: elog.h:43
#define XLogRecPtrIsInvalid(r)
Definition: xlogdefs.h:29
XLogRecPtr end
Definition: timeline.h:29
#define lfirst(lc)
Definition: pg_list.h:106
XLogRecPtr begin
Definition: timeline.h:28
#define elog
Definition: elog.h:219
XLogRecPtr tliSwitchPoint ( TimeLineID  tli,
List history,
TimeLineID nextTLI 
)

Definition at line 563 of file timeline.c.

References TimeLineHistoryEntry::end, ereport, errmsg(), ERROR, InvalidXLogRecPtr, lfirst, and TimeLineHistoryEntry::tli.

Referenced by StartReplication(), StartupXLOG(), XLogReadDetermineTimeline(), and XLogSendPhysical().

564 {
565  ListCell *cell;
566 
567  if (nextTLI)
568  *nextTLI = 0;
569  foreach(cell, history)
570  {
572 
573  if (tle->tli == tli)
574  return tle->end;
575  if (nextTLI)
576  *nextTLI = tle->tli;
577  }
578 
579  ereport(ERROR,
580  (errmsg("requested timeline %u is not in this server's history",
581  tli)));
582  return InvalidXLogRecPtr; /* keep compiler quiet */
583 }
#define InvalidXLogRecPtr
Definition: xlogdefs.h:28
TimeLineID tli
Definition: timeline.h:27
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
XLogRecPtr end
Definition: timeline.h:29
#define lfirst(lc)
Definition: pg_list.h:106
int errmsg(const char *fmt,...)
Definition: elog.c:797
void writeTimeLineHistory ( TimeLineID  newTLI,
TimeLineID  parentTLI,
XLogRecPtr  switchpoint,
char *  reason 
)

Definition at line 289 of file timeline.c.

References ArchiveRecoveryRequested, Assert, CloseTransientFile(), durable_link_or_rename(), ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), MAXFNAMELEN, MAXPGPATH, OpenTransientFile(), pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), read, RestoreArchivedFile(), snprintf(), TLHistoryFileName, TLHistoryFilePath, unlink(), WAIT_EVENT_TIMELINE_HISTORY_READ, WAIT_EVENT_TIMELINE_HISTORY_SYNC, WAIT_EVENT_TIMELINE_HISTORY_WRITE, write, XLogArchiveNotify(), XLogArchivingActive, and XLOGDIR.

Referenced by StartupXLOG().

291 {
292  char path[MAXPGPATH];
293  char tmppath[MAXPGPATH];
294  char histfname[MAXFNAMELEN];
295  char buffer[BLCKSZ];
296  int srcfd;
297  int fd;
298  int nbytes;
299 
300  Assert(newTLI > parentTLI); /* else bad selection of newTLI */
301 
302  /*
303  * Write into a temp file name.
304  */
305  snprintf(tmppath, MAXPGPATH, XLOGDIR "/xlogtemp.%d", (int) getpid());
306 
307  unlink(tmppath);
308 
309  /* do not use get_sync_bit() here --- want to fsync only at end of fill */
310  fd = OpenTransientFile(tmppath, O_RDWR | O_CREAT | O_EXCL,
311  S_IRUSR | S_IWUSR);
312  if (fd < 0)
313  ereport(ERROR,
315  errmsg("could not create file \"%s\": %m", tmppath)));
316 
317  /*
318  * If a history file exists for the parent, copy it verbatim
319  */
321  {
322  TLHistoryFileName(histfname, parentTLI);
323  RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false);
324  }
325  else
326  TLHistoryFilePath(path, parentTLI);
327 
328  srcfd = OpenTransientFile(path, O_RDONLY, 0);
329  if (srcfd < 0)
330  {
331  if (errno != ENOENT)
332  ereport(ERROR,
334  errmsg("could not open file \"%s\": %m", path)));
335  /* Not there, so assume parent has no parents */
336  }
337  else
338  {
339  for (;;)
340  {
341  errno = 0;
343  nbytes = (int) read(srcfd, buffer, sizeof(buffer));
345  if (nbytes < 0 || errno != 0)
346  ereport(ERROR,
348  errmsg("could not read file \"%s\": %m", path)));
349  if (nbytes == 0)
350  break;
351  errno = 0;
353  if ((int) write(fd, buffer, nbytes) != nbytes)
354  {
355  int save_errno = errno;
356 
357  /*
358  * If we fail to make the file, delete it to release disk
359  * space
360  */
361  unlink(tmppath);
362 
363  /*
364  * if write didn't set errno, assume problem is no disk space
365  */
366  errno = save_errno ? save_errno : ENOSPC;
367 
368  ereport(ERROR,
370  errmsg("could not write to file \"%s\": %m", tmppath)));
371  }
373  }
374  CloseTransientFile(srcfd);
375  }
376 
377  /*
378  * Append one line with the details of this timeline split.
379  *
380  * If we did have a parent file, insert an extra newline just in case the
381  * parent file failed to end with one.
382  */
383  snprintf(buffer, sizeof(buffer),
384  "%s%u\t%X/%X\t%s\n",
385  (srcfd < 0) ? "" : "\n",
386  parentTLI,
387  (uint32) (switchpoint >> 32), (uint32) (switchpoint),
388  reason);
389 
390  nbytes = strlen(buffer);
391  errno = 0;
392  if ((int) write(fd, buffer, nbytes) != nbytes)
393  {
394  int save_errno = errno;
395 
396  /*
397  * If we fail to make the file, delete it to release disk space
398  */
399  unlink(tmppath);
400  /* if write didn't set errno, assume problem is no disk space */
401  errno = save_errno ? save_errno : ENOSPC;
402 
403  ereport(ERROR,
405  errmsg("could not write to file \"%s\": %m", tmppath)));
406  }
407 
409  if (pg_fsync(fd) != 0)
410  ereport(ERROR,
412  errmsg("could not fsync file \"%s\": %m", tmppath)));
414 
415  if (CloseTransientFile(fd))
416  ereport(ERROR,
418  errmsg("could not close file \"%s\": %m", tmppath)));
419 
420 
421  /*
422  * Now move the completed history file into place with its final name.
423  */
424  TLHistoryFilePath(path, newTLI);
425 
426  /*
427  * Perform the rename using link if available, paranoidly trying to avoid
428  * overwriting an existing file (there shouldn't be one).
429  */
430  durable_link_or_rename(tmppath, path, ERROR);
431 
432  /* The history file can be archived immediately. */
433  if (XLogArchivingActive())
434  {
435  TLHistoryFileName(histfname, newTLI);
436  XLogArchiveNotify(histfname);
437  }
438 }
bool ArchiveRecoveryRequested
Definition: xlog.c:246
#define write(a, b, c)
Definition: win32.h:19
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:51
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
static int fd(const char *x, int i)
Definition: preproc-init.c:105
void XLogArchiveNotify(const char *xlog)
Definition: xlogarchive.c:512
#define ERROR
Definition: elog.h:43
#define MAXPGPATH
#define TLHistoryFileName(fname, tli)
int OpenTransientFile(FileName fileName, int fileFlags, int fileMode)
Definition: fd.c:2107
int errcode_for_file_access(void)
Definition: elog.c:598
unsigned int uint32
Definition: c.h:268
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1203
int unlink(const char *filename)
#define ereport(elevel, rest)
Definition: elog.h:122
int CloseTransientFile(int fd)
Definition: fd.c:2268
#define MAXFNAMELEN
#define XLOGDIR
#define Assert(condition)
Definition: c.h:675
#define XLogArchivingActive()
Definition: xlog.h:134
int durable_link_or_rename(const char *oldfile, const char *newfile, int elevel)
Definition: fd.c:675
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition: pgstat.h:1179
int errmsg(const char *fmt,...)
Definition: elog.c:797
int pg_fsync(int fd)
Definition: fd.c:333
#define read(a, b, c)
Definition: win32.h:18
#define TLHistoryFilePath(path, tli)
void writeTimeLineHistoryFile ( TimeLineID  tli,
char *  content,
int  size 
)

Definition at line 448 of file timeline.c.

References CloseTransientFile(), durable_link_or_rename(), ereport, errcode_for_file_access(), errmsg(), ERROR, fd(), MAXPGPATH, OpenTransientFile(), pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), snprintf(), TLHistoryFilePath, unlink(), WAIT_EVENT_TIMELINE_HISTORY_FILE_SYNC, WAIT_EVENT_TIMELINE_HISTORY_FILE_WRITE, write, and XLOGDIR.

Referenced by WalRcvFetchTimeLineHistoryFiles().

449 {
450  char path[MAXPGPATH];
451  char tmppath[MAXPGPATH];
452  int fd;
453 
454  /*
455  * Write into a temp file name.
456  */
457  snprintf(tmppath, MAXPGPATH, XLOGDIR "/xlogtemp.%d", (int) getpid());
458 
459  unlink(tmppath);
460 
461  /* do not use get_sync_bit() here --- want to fsync only at end of fill */
462  fd = OpenTransientFile(tmppath, O_RDWR | O_CREAT | O_EXCL,
463  S_IRUSR | S_IWUSR);
464  if (fd < 0)
465  ereport(ERROR,
467  errmsg("could not create file \"%s\": %m", tmppath)));
468 
469  errno = 0;
471  if ((int) write(fd, content, size) != size)
472  {
473  int save_errno = errno;
474 
475  /*
476  * If we fail to make the file, delete it to release disk space
477  */
478  unlink(tmppath);
479  /* if write didn't set errno, assume problem is no disk space */
480  errno = save_errno ? save_errno : ENOSPC;
481 
482  ereport(ERROR,
484  errmsg("could not write to file \"%s\": %m", tmppath)));
485  }
487 
489  if (pg_fsync(fd) != 0)
490  ereport(ERROR,
492  errmsg("could not fsync file \"%s\": %m", tmppath)));
494 
495  if (CloseTransientFile(fd))
496  ereport(ERROR,
498  errmsg("could not close file \"%s\": %m", tmppath)));
499 
500 
501  /*
502  * Now move the completed history file into place with its final name.
503  */
504  TLHistoryFilePath(path, tli);
505 
506  /*
507  * Perform the rename using link if available, paranoidly trying to avoid
508  * overwriting an existing file (there shouldn't be one).
509  */
510  durable_link_or_rename(tmppath, path, ERROR);
511 }
#define write(a, b, c)
Definition: win32.h:19
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
static int fd(const char *x, int i)
Definition: preproc-init.c:105
#define ERROR
Definition: elog.h:43
#define MAXPGPATH
int OpenTransientFile(FileName fileName, int fileFlags, int fileMode)
Definition: fd.c:2107
int errcode_for_file_access(void)
Definition: elog.c:598
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1203
int unlink(const char *filename)
#define ereport(elevel, rest)
Definition: elog.h:122
int CloseTransientFile(int fd)
Definition: fd.c:2268
#define XLOGDIR
int durable_link_or_rename(const char *oldfile, const char *newfile, int elevel)
Definition: fd.c:675
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition: pgstat.h:1179
int errmsg(const char *fmt,...)
Definition: elog.c:797
int pg_fsync(int fd)
Definition: fd.c:333
#define TLHistoryFilePath(path, tli)