From 8143a56854a4f46968b12badb5b008f448e08ef5 Mon Sep 17 00:00:00 2001 From: Simon Riggs Date: Wed, 8 Aug 2012 21:25:23 +0100 Subject: [PATCH] Fix minor bug in XLogFileRead() that accidentally worked. Cascading replication copied the incoming file into pg_xlog but didn't set path correctly, so the first attempt to open file failed causing it to loop around and look for file in pg_xlog. So the earlier coding worked, but accidentally rather than by design. Spotted by Fujii Masao, fix by Fujii Masao and Simon Riggs --- src/backend/access/transam/xlog.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index efd0347bc9..efda4634d5 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -2805,6 +2805,11 @@ XLogFileRead(XLogSegNo segno, int emode, TimeLineID tli, errmsg("could not rename file \"%s\" to \"%s\": %m", path, xlogfpath))); + /* + * Set path to point at the new file in pg_xlog. + */ + strncpy(path, xlogfpath, MAXPGPATH); + /* * If the existing segment was replaced, since walsenders might have * it open, request them to reload a currently-open segment.