]> granicus.if.org Git - postgresql/commitdiff
Need to use the start pointer of a block we read from WAL segment in
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 12 Apr 2010 10:18:50 +0000 (10:18 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 12 Apr 2010 10:18:50 +0000 (10:18 +0000)
the calculation, not the end pointer, as pointed out by Fujii Masao.

src/backend/replication/walsender.c

index aa8fbc1a40b7e227837b0ff043e4a0e15f4a6d4d..26fddba10b60b5d505d0eccf98fc3058c272b79c 100644 (file)
@@ -30,7 +30,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.15 2010/04/12 09:52:29 heikki Exp $
+ *       $PostgreSQL: pgsql/src/backend/replication/walsender.c,v 1.16 2010/04/12 10:18:50 heikki Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -506,8 +506,8 @@ WalSndKill(int code, Datum arg)
 void
 XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
 {
+       XLogRecPtr      startRecPtr = recptr;
        char            path[MAXPGPATH];
-       uint32          startoff;
        uint32          lastRemovedLog;
        uint32          lastRemovedSeg;
        uint32          log;
@@ -515,6 +515,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
 
        while (nbytes > 0)
        {
+               uint32          startoff;
                int                     segbytes;
                int                     readbytes;
 
@@ -596,7 +597,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
         * already have been overwritten with new WAL records.
         */
        XLogGetLastRemoved(&lastRemovedLog, &lastRemovedSeg);
-       XLByteToPrevSeg(recptr, log, seg);
+       XLByteToSeg(startRecPtr, log, seg);
        if (log < lastRemovedLog ||
                (log == lastRemovedLog && seg <= lastRemovedSeg))
        {