Commit 258174b4 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Need to use the start pointer of a block we read from WAL segment in

the calculation, not the end pointer, as pointed out by Fujii Masao.
parent e76b4e0d
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -506,8 +506,8 @@ WalSndKill(int code, Datum arg)
void void
XLogRead(char *buf, XLogRecPtr recptr, Size nbytes) XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
{ {
XLogRecPtr startRecPtr = recptr;
char path[MAXPGPATH]; char path[MAXPGPATH];
uint32 startoff;
uint32 lastRemovedLog; uint32 lastRemovedLog;
uint32 lastRemovedSeg; uint32 lastRemovedSeg;
uint32 log; uint32 log;
...@@ -515,6 +515,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes) ...@@ -515,6 +515,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
while (nbytes > 0) while (nbytes > 0)
{ {
uint32 startoff;
int segbytes; int segbytes;
int readbytes; int readbytes;
...@@ -596,7 +597,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes) ...@@ -596,7 +597,7 @@ XLogRead(char *buf, XLogRecPtr recptr, Size nbytes)
* already have been overwritten with new WAL records. * already have been overwritten with new WAL records.
*/ */
XLogGetLastRemoved(&lastRemovedLog, &lastRemovedSeg); XLogGetLastRemoved(&lastRemovedLog, &lastRemovedSeg);
XLByteToPrevSeg(recptr, log, seg); XLByteToSeg(startRecPtr, log, seg);
if (log < lastRemovedLog || if (log < lastRemovedLog ||
(log == lastRemovedLog && seg <= lastRemovedSeg)) (log == lastRemovedLog && seg <= lastRemovedSeg))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment