PostgreSQL Source Code  git master
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/xlogarchive.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

◆ existsTimeLineHistory()

bool existsTimeLineHistory ( TimeLineID  probeTLI)

Definition at line 208 of file timeline.c.

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

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

209 {
210  char path[MAXPGPATH];
211  char histfname[MAXFNAMELEN];
212  FILE *fd;
213 
214  /* Timeline 1 does not have a history file, so no need to check */
215  if (probeTLI == 1)
216  return false;
217 
219  {
220  TLHistoryFileName(histfname, probeTLI);
221  RestoreArchivedFile(path, histfname, "RECOVERYHISTORY", 0, false);
222  }
223  else
224  TLHistoryFilePath(path, probeTLI);
225 
226  fd = AllocateFile(path, "r");
227  if (fd != NULL)
228  {
229  FreeFile(fd);
230  return true;
231  }
232  else
233  {
234  if (errno != ENOENT)
235  ereport(FATAL,
237  errmsg("could not open file \"%s\": %m", path)));
238  return false;
239  }
240 }
bool ArchiveRecoveryRequested
Definition: xlog.c:262
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:53
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:633
FILE * AllocateFile(const char *name, const char *mode)
Definition: fd.c:2320
#define MAXFNAMELEN
#define ereport(elevel,...)
Definition: elog.h:144
int FreeFile(FILE *file)
Definition: fd.c:2519
int errmsg(const char *fmt,...)
Definition: elog.c:824
#define TLHistoryFilePath(path, tli)

◆ findNewestTimeLine()

TimeLineID findNewestTimeLine ( TimeLineID  startTLI)

Definition at line 250 of file timeline.c.

References existsTimeLineHistory().

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

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

◆ readTimeLineHistory()

List* readTimeLineHistory ( TimeLineID  targetTLI)

Definition at line 76 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, palloc(), RestoreArchivedFile(), TLHistoryFileName, TLHistoryFilePath, and TimeLineHistoryEntry::tli.

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

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

◆ restoreTimeLineHistoryFiles()

void restoreTimeLineHistoryFiles ( TimeLineID  begin,
TimeLineID  end 
)

Definition at line 50 of file timeline.c.

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

Referenced by rescanLatestTimeLine(), and StartupXLOG().

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

◆ tliInHistory()

bool tliInHistory ( TimeLineID  tli,
List expectedTLEs 
)

Definition at line 518 of file timeline.c.

References lfirst.

Referenced by checkTimeLineSwitch(), and ReadRecord().

519 {
520  ListCell *cell;
521 
522  foreach(cell, expectedTLEs)
523  {
524  if (((TimeLineHistoryEntry *) lfirst(cell))->tli == tli)
525  return true;
526  }
527 
528  return false;
529 }
#define lfirst(lc)
Definition: pg_list.h:190

◆ tliOfPointInHistory()

TimeLineID tliOfPointInHistory ( XLogRecPtr  ptr,
List history 
)

Definition at line 536 of file timeline.c.

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

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

537 {
538  ListCell *cell;
539 
540  foreach(cell, history)
541  {
543 
544  if ((XLogRecPtrIsInvalid(tle->begin) || tle->begin <= ptr) &&
545  (XLogRecPtrIsInvalid(tle->end) || ptr < tle->end))
546  {
547  /* found it */
548  return tle->tli;
549  }
550  }
551 
552  /* shouldn't happen. */
553  elog(ERROR, "timeline history was not contiguous");
554  return 0; /* keep compiler quiet */
555 }
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:190
XLogRecPtr begin
Definition: timeline.h:28
#define elog(elevel,...)
Definition: elog.h:214

◆ tliSwitchPoint()

XLogRecPtr tliSwitchPoint ( TimeLineID  tli,
List history,
TimeLineID nextTLI 
)

Definition at line 564 of file timeline.c.

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

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

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

◆ writeTimeLineHistory()

void writeTimeLineHistory ( TimeLineID  newTLI,
TimeLineID  parentTLI,
XLogRecPtr  switchpoint,
char *  reason 
)

Definition at line 290 of file timeline.c.

References ArchiveRecoveryRequested, Assert, CloseTransientFile(), data_sync_elevel(), durable_rename_excl(), 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, WAIT_EVENT_TIMELINE_HISTORY_READ, WAIT_EVENT_TIMELINE_HISTORY_SYNC, WAIT_EVENT_TIMELINE_HISTORY_WRITE, write, XLogArchiveNotify(), XLogArchivingActive, and XLOGDIR.

Referenced by StartupXLOG().

292 {
293  char path[MAXPGPATH];
294  char tmppath[MAXPGPATH];
295  char histfname[MAXFNAMELEN];
296  char buffer[BLCKSZ];
297  int srcfd;
298  int fd;
299  int nbytes;
300 
301  Assert(newTLI > parentTLI); /* else bad selection of newTLI */
302 
303  /*
304  * Write into a temp file name.
305  */
306  snprintf(tmppath, MAXPGPATH, XLOGDIR "/xlogtemp.%d", (int) getpid());
307 
308  unlink(tmppath);
309 
310  /* do not use get_sync_bit() here --- want to fsync only at end of fill */
311  fd = OpenTransientFile(tmppath, O_RDWR | O_CREAT | O_EXCL);
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);
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 
375  if (CloseTransientFile(srcfd) != 0)
376  ereport(ERROR,
378  errmsg("could not close file \"%s\": %m", path)));
379  }
380 
381  /*
382  * Append one line with the details of this timeline split.
383  *
384  * If we did have a parent file, insert an extra newline just in case the
385  * parent file failed to end with one.
386  */
387  snprintf(buffer, sizeof(buffer),
388  "%s%u\t%X/%X\t%s\n",
389  (srcfd < 0) ? "" : "\n",
390  parentTLI,
391  (uint32) (switchpoint >> 32), (uint32) (switchpoint),
392  reason);
393 
394  nbytes = strlen(buffer);
395  errno = 0;
396  if ((int) write(fd, buffer, nbytes) != nbytes)
397  {
398  int save_errno = errno;
399 
400  /*
401  * If we fail to make the file, delete it to release disk space
402  */
403  unlink(tmppath);
404  /* if write didn't set errno, assume problem is no disk space */
405  errno = save_errno ? save_errno : ENOSPC;
406 
407  ereport(ERROR,
409  errmsg("could not write to file \"%s\": %m", tmppath)));
410  }
411 
413  if (pg_fsync(fd) != 0)
416  errmsg("could not fsync file \"%s\": %m", tmppath)));
418 
419  if (CloseTransientFile(fd) != 0)
420  ereport(ERROR,
422  errmsg("could not close file \"%s\": %m", tmppath)));
423 
424  /*
425  * Now move the completed history file into place with its final name.
426  */
427  TLHistoryFilePath(path, newTLI);
428 
429  /*
430  * Perform the rename using link if available, paranoidly trying to avoid
431  * overwriting an existing file (there shouldn't be one).
432  */
433  durable_rename_excl(tmppath, path, ERROR);
434 
435  /* The history file can be archived immediately. */
436  if (XLogArchivingActive())
437  {
438  TLHistoryFileName(histfname, newTLI);
439  XLogArchiveNotify(histfname);
440  }
441 }
bool ArchiveRecoveryRequested
Definition: xlog.c:262
#define write(a, b, c)
Definition: win32.h:14
bool RestoreArchivedFile(char *path, const char *xlogfname, const char *recovername, off_t expectedSize, bool cleanupEnabled)
Definition: xlogarchive.c:53
static int fd(const char *x, int i)
Definition: preproc-init.c:105
void XLogArchiveNotify(const char *xlog)
Definition: xlogarchive.c:466
int durable_rename_excl(const char *oldfile, const char *newfile, int elevel)
Definition: fd.c:783
#define ERROR
Definition: elog.h:43
int OpenTransientFile(const char *fileName, int fileFlags)
Definition: fd.c:2370
#define MAXPGPATH
#define TLHistoryFileName(fname, tli)
int errcode_for_file_access(void)
Definition: elog.c:633
unsigned int uint32
Definition: c.h:367
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1330
int CloseTransientFile(int fd)
Definition: fd.c:2547
#define MAXFNAMELEN
#define XLOGDIR
int data_sync_elevel(int elevel)
Definition: fd.c:3597
#define ereport(elevel,...)
Definition: elog.h:144
#define Assert(condition)
Definition: c.h:738
#define XLogArchivingActive()
Definition: xlog.h:171
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition: pgstat.h:1306
int errmsg(const char *fmt,...)
Definition: elog.c:824
int pg_fsync(int fd)
Definition: fd.c:343
#define snprintf
Definition: port.h:193
#define read(a, b, c)
Definition: win32.h:13
#define TLHistoryFilePath(path, tli)

◆ writeTimeLineHistoryFile()

void writeTimeLineHistoryFile ( TimeLineID  tli,
char *  content,
int  size 
)

Definition at line 451 of file timeline.c.

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

Referenced by WalRcvFetchTimeLineHistoryFiles().

452 {
453  char path[MAXPGPATH];
454  char tmppath[MAXPGPATH];
455  int fd;
456 
457  /*
458  * Write into a temp file name.
459  */
460  snprintf(tmppath, MAXPGPATH, XLOGDIR "/xlogtemp.%d", (int) getpid());
461 
462  unlink(tmppath);
463 
464  /* do not use get_sync_bit() here --- want to fsync only at end of fill */
465  fd = OpenTransientFile(tmppath, O_RDWR | O_CREAT | O_EXCL);
466  if (fd < 0)
467  ereport(ERROR,
469  errmsg("could not create file \"%s\": %m", tmppath)));
470 
471  errno = 0;
473  if ((int) write(fd, content, size) != size)
474  {
475  int save_errno = errno;
476 
477  /*
478  * If we fail to make the file, delete it to release disk space
479  */
480  unlink(tmppath);
481  /* if write didn't set errno, assume problem is no disk space */
482  errno = save_errno ? save_errno : ENOSPC;
483 
484  ereport(ERROR,
486  errmsg("could not write to file \"%s\": %m", tmppath)));
487  }
489 
491  if (pg_fsync(fd) != 0)
494  errmsg("could not fsync file \"%s\": %m", tmppath)));
496 
497  if (CloseTransientFile(fd) != 0)
498  ereport(ERROR,
500  errmsg("could not close file \"%s\": %m", tmppath)));
501 
502  /*
503  * Now move the completed history file into place with its final name.
504  */
505  TLHistoryFilePath(path, tli);
506 
507  /*
508  * Perform the rename using link if available, paranoidly trying to avoid
509  * overwriting an existing file (there shouldn't be one).
510  */
511  durable_rename_excl(tmppath, path, ERROR);
512 }
#define write(a, b, c)
Definition: win32.h:14
static int fd(const char *x, int i)
Definition: preproc-init.c:105
int durable_rename_excl(const char *oldfile, const char *newfile, int elevel)
Definition: fd.c:783
#define ERROR
Definition: elog.h:43
int OpenTransientFile(const char *fileName, int fileFlags)
Definition: fd.c:2370
#define MAXPGPATH
int errcode_for_file_access(void)
Definition: elog.c:633
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1330
int CloseTransientFile(int fd)
Definition: fd.c:2547
#define XLOGDIR
int data_sync_elevel(int elevel)
Definition: fd.c:3597
#define ereport(elevel,...)
Definition: elog.h:144
static void pgstat_report_wait_start(uint32 wait_event_info)
Definition: pgstat.h:1306
int errmsg(const char *fmt,...)
Definition: elog.c:824
int pg_fsync(int fd)
Definition: fd.c:343
#define snprintf
Definition: port.h:193
#define TLHistoryFilePath(path, tli)