mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-11-24 08:52:38 +02:00
Remove use of xlog_fname in code
Let's rely on Postgres stuff instead. Based on a patch by YUriy Zhuravlev for the backup part, updated by me for the restore part.
This commit is contained in:
parent
c5c07d8613
commit
9f1424bc87
6
backup.c
6
backup.c
@ -626,6 +626,7 @@ wait_for_archive(pgBackup *backup, const char *sql)
|
||||
int try_count;
|
||||
XLogRecPtr lsn;
|
||||
TimeLineID tli;
|
||||
XLogSegNo targetSegNo;
|
||||
|
||||
reconnect();
|
||||
res = execute(sql, 0, NULL);
|
||||
@ -651,12 +652,13 @@ wait_for_archive(pgBackup *backup, const char *sql)
|
||||
}
|
||||
|
||||
/* As well as WAL file name */
|
||||
xlog_fname(file_name, tli, lsn);
|
||||
XLByteToSeg(lsn, targetSegNo);
|
||||
XLogFileName(file_name, tli, targetSegNo + 1);
|
||||
|
||||
snprintf(ready_path, lengthof(ready_path),
|
||||
"%s/pg_xlog/archive_status/%s.ready", pgdata,
|
||||
file_name);
|
||||
elog(LOG, "%s() wait for %s", __FUNCTION__, ready_path);
|
||||
elog(LOG, "%s() wait for %s\n", __FUNCTION__, ready_path);
|
||||
|
||||
PQclear(res);
|
||||
|
||||
|
@ -287,7 +287,6 @@ extern int pgFileCompareMtimeDesc(const void *f1, const void *f2);
|
||||
|
||||
/* in xlog.c */
|
||||
extern bool xlog_is_complete_wal(const pgFile *file);
|
||||
extern void xlog_fname(char *fname, TimeLineID tli, XLogRecPtr lsn);
|
||||
|
||||
/* in data.c */
|
||||
extern bool backup_data_file(const char *from_root, const char *to_root,
|
||||
|
@ -772,8 +772,10 @@ search_next_wal(const char *path, XLogRecPtr *need_lsn, parray *timelines)
|
||||
for (i = 0; i < parray_num(timelines); i++)
|
||||
{
|
||||
pgTimeLine *timeline = (pgTimeLine *) parray_get(timelines, i);
|
||||
XLogSegNo targetSegNo;
|
||||
|
||||
xlog_fname(xlogfname, timeline->tli, *need_lsn);
|
||||
XLByteToSeg(*need_lsn, targetSegNo);
|
||||
XLogFileName(xlogfname, timeline->tli, targetSegNo);
|
||||
join_path_components(xlogpath, path, xlogfname);
|
||||
|
||||
if (stat(xlogpath, &st) == 0)
|
||||
|
11
xlog.c
11
xlog.c
@ -68,14 +68,3 @@ xlog_is_complete_wal(const pgFile *file)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* based on XLogFileName() in xlog_internal.h
|
||||
*/
|
||||
void
|
||||
xlog_fname(char *fname, TimeLineID tli, XLogRecPtr lsn)
|
||||
{
|
||||
snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli,
|
||||
(uint32) (lsn >> 32),
|
||||
(uint32) (lsn / XLogSegSize));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user