mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
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.
This commit is contained in:
parent
e76b4e0ddb
commit
258174b462
@ -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)
|
|||||||
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)
|
|||||||
|
|
||||||
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)
|
|||||||
* 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))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user