]> granicus.if.org Git - postgresql/commitdiff
Fix minor bug in XLogFileRead() that accidentally worked.
authorSimon Riggs <simon@2ndQuadrant.com>
Wed, 8 Aug 2012 20:28:41 +0000 (21:28 +0100)
committerSimon Riggs <simon@2ndQuadrant.com>
Wed, 8 Aug 2012 20:28:41 +0000 (21:28 +0100)
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

index 37c0eda510ad3d35ce2481a57ad9832fc1d98049..7b9b483ed9700d24794610611181400ed681208f 100644 (file)
@@ -2809,6 +2809,11 @@ XLogFileRead(uint32 log, uint32 seg, 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.