Skip to content

Commit 2103430

Browse files
committed
Fix parsing of xlog file name in pg_receivexlog.
The parsing of WAL filenames of segments larger than > 255 was broken, making pg_receivexlog unable to restart streaming after stopping it. The bug was introduced by the changes in 9.3 to represent WAL segment number as a 64-bit integer instead of two ints, log and seg. To fix, replace the plain sscanf call with XLogFromFileName macro, which does the conversion from log+seg to a 64-bit integer correcly. Reported by Mika Eloranta.
1 parent e36ce0c commit 2103430

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/bin/pg_basebackup/pg_receivexlog.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ FindStreamingStart(uint32 *tli)
134134
while ((dirent = readdir(dir)) != NULL)
135135
{
136136
uint32 tli;
137-
unsigned int log,
138-
seg;
139137
XLogSegNo segno;
140138
bool ispartial;
141139

@@ -164,14 +162,7 @@ FindStreamingStart(uint32 *tli)
164162
/*
165163
* Looks like an xlog file. Parse its position.
166164
*/
167-
if (sscanf(dirent->d_name, "%08X%08X%08X", &tli, &log, &seg) != 3)
168-
{
169-
fprintf(stderr,
170-
_("%s: could not parse transaction log file name \"%s\"\n"),
171-
progname, dirent->d_name);
172-
disconnect_and_exit(1);
173-
}
174-
segno = ((uint64) log) << 32 | seg;
165+
XLogFromFileName(dirent->d_name, &tli, &segno);
175166

176167
/*
177168
* Check that the segment has the right size, if it's supposed to be

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