61 sscanf(dent->
d_name,
"%08X%08X%08X%08X%08X",
62 &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4]);
64 file_start_lsn = ((uint64) tmp[1]) << 32 | tmp[2];
65 file_end_lsn = ((uint64) tmp[3]) << 32 | tmp[4];
68 if (tli != 0 && tli != file_tli)
112 if (tli != 0 && tli != ws->
tli)
183 if (current_lsn >= end_lsn)
193 *missing_lsn = current_lsn;
211 XLOGDIR "/summaries/%08X%08X%08X%08X%08X.summary",
217 if (file < 0 && (errno != EEXIST || !missing_ok))
220 errmsg(
"could not open file \"%s\": %m", path)));
236 XLOGDIR "/summaries/%08X%08X%08X%08X%08X.summary",
241 if (
lstat(path, &statbuf) != 0)
247 errmsg(
"could not stat file \"%s\": %m", path)));
249 if (statbuf.
st_mtime >= cutoff_time)
251 if (unlink(path) != 0)
254 errmsg(
"could not stat file \"%s\": %m", path)));
265 return strspn(
filename,
"0123456789ABCDEF") == 40 &&
266 strcmp(
filename + 40,
".summary") == 0;
279 WAIT_EVENT_WAL_SUMMARY_READ);
283 errmsg(
"could not read file \"%s\": %m",
300 WAIT_EVENT_WAL_SUMMARY_WRITE);
304 errmsg(
"could not write file \"%s\": %m",
306 if (nbytes != length)
309 errmsg(
"could not write file \"%s\": wrote only %d of %d bytes at offset %u",
311 length, (
unsigned) io->
filepos),
312 errhint(
"Check free disk space.")));
int errmsg_internal(const char *fmt,...)
int errcode_for_file_access(void)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
struct dirent * ReadDir(DIR *dir, const char *dirname)
File PathNameOpenFile(const char *fileName, int fileFlags)
char * FilePathName(File file)
DIR * AllocateDir(const char *dirname)
static ssize_t FileRead(File file, void *buffer, size_t amount, off_t offset, uint32 wait_event_info)
static ssize_t FileWrite(File file, const void *buffer, size_t amount, off_t offset, uint32 wait_event_info)
static int pg_cmp_u64(uint64 a, uint64 b)
static void const char * fmt
void list_sort(List *list, list_sort_comparator cmp)
List * lappend(List *list, void *datum)
List * list_copy(const List *oldlist)
#define ERRCODE_DATA_CORRUPTED
int appendStringInfoVA(StringInfo str, const char *fmt, va_list args)
void enlargeStringInfo(StringInfo str, int needed)
void initStringInfo(StringInfo str)
void RemoveWalSummaryIfOlderThan(WalSummaryFile *ws, time_t cutoff_time)
static bool IsWalSummaryFilename(char *filename)
File OpenWalSummaryFile(WalSummaryFile *ws, bool missing_ok)
static int ListComparatorForWalSummaryFiles(const ListCell *a, const ListCell *b)
List * GetWalSummaries(TimeLineID tli, XLogRecPtr start_lsn, XLogRecPtr end_lsn)
bool WalSummariesAreComplete(List *wslist, XLogRecPtr start_lsn, XLogRecPtr end_lsn, XLogRecPtr *missing_lsn)
int ReadWalSummary(void *wal_summary_io, void *data, int length)
List * FilterWalSummaries(List *wslist, TimeLineID tli, XLogRecPtr start_lsn, XLogRecPtr end_lsn)
void ReportWalSummaryError(void *callback_arg, char *fmt,...)
int WriteWalSummary(void *wal_summary_io, void *data, int length)
#define LSN_FORMAT_ARGS(lsn)
#define XLogRecPtrIsInvalid(r)
#define InvalidXLogRecPtr