Skip to content

Commit 9f1424b

Browse files
author
Michael Paquier
committed
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.
1 parent c5c07d8 commit 9f1424b

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

backup.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ wait_for_archive(pgBackup *backup, const char *sql)
626626
int try_count;
627627
XLogRecPtr lsn;
628628
TimeLineID tli;
629+
XLogSegNo targetSegNo;
629630

630631
reconnect();
631632
res = execute(sql, 0, NULL);
@@ -651,12 +652,13 @@ wait_for_archive(pgBackup *backup, const char *sql)
651652
}
652653

653654
/* As well as WAL file name */
654-
xlog_fname(file_name, tli, lsn);
655+
XLByteToSeg(lsn, targetSegNo);
656+
XLogFileName(file_name, tli, targetSegNo + 1);
655657

656658
snprintf(ready_path, lengthof(ready_path),
657659
"%s/pg_xlog/archive_status/%s.ready", pgdata,
658660
file_name);
659-
elog(LOG, "%s() wait for %s", __FUNCTION__, ready_path);
661+
elog(LOG, "%s() wait for %s\n", __FUNCTION__, ready_path);
660662

661663
PQclear(res);
662664

pg_arman.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ extern int pgFileCompareMtimeDesc(const void *f1, const void *f2);
287287

288288
/* in xlog.c */
289289
extern bool xlog_is_complete_wal(const pgFile *file);
290-
extern void xlog_fname(char *fname, TimeLineID tli, XLogRecPtr lsn);
291290

292291
/* in data.c */
293292
extern bool backup_data_file(const char *from_root, const char *to_root,

restore.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,10 @@ search_next_wal(const char *path, XLogRecPtr *need_lsn, parray *timelines)
772772
for (i = 0; i < parray_num(timelines); i++)
773773
{
774774
pgTimeLine *timeline = (pgTimeLine *) parray_get(timelines, i);
775+
XLogSegNo targetSegNo;
775776

776-
xlog_fname(xlogfname, timeline->tli, *need_lsn);
777+
XLByteToSeg(*need_lsn, targetSegNo);
778+
XLogFileName(xlogfname, timeline->tli, targetSegNo);
777779
join_path_components(xlogpath, path, xlogfname);
778780

779781
if (stat(xlogpath, &st) == 0)

xlog.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,3 @@ xlog_is_complete_wal(const pgFile *file)
6868

6969
return true;
7070
}
71-
72-
/*
73-
* based on XLogFileName() in xlog_internal.h
74-
*/
75-
void
76-
xlog_fname(char *fname, TimeLineID tli, XLogRecPtr lsn)
77-
{
78-
snprintf(fname, MAXFNAMELEN, "%08X%08X%08X", tli,
79-
(uint32) (lsn >> 32),
80-
(uint32) (lsn / XLogSegSize));
81-
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy