diff options
Diffstat (limited to 'src/backend/replication/walsender.c')
-rw-r--r-- | src/backend/replication/walsender.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 1fbe8ed71b0..56999e93157 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -2316,9 +2316,9 @@ retry: int segbytes; int readbytes; - startoff = recptr % XLogSegSize; + startoff = XLogSegmentOffset(recptr, wal_segment_size); - if (sendFile < 0 || !XLByteInSeg(recptr, sendSegNo)) + if (sendFile < 0 || !XLByteInSeg(recptr, sendSegNo, wal_segment_size)) { char path[MAXPGPATH]; @@ -2326,7 +2326,7 @@ retry: if (sendFile >= 0) close(sendFile); - XLByteToSeg(recptr, sendSegNo); + XLByteToSeg(recptr, sendSegNo, wal_segment_size); /*------- * When reading from a historic timeline, and there is a timeline @@ -2359,12 +2359,12 @@ retry: { XLogSegNo endSegNo; - XLByteToSeg(sendTimeLineValidUpto, endSegNo); + XLByteToSeg(sendTimeLineValidUpto, endSegNo, wal_segment_size); if (sendSegNo == endSegNo) curFileTimeLine = sendTimeLineNextTLI; } - XLogFilePath(path, curFileTimeLine, sendSegNo); + XLogFilePath(path, curFileTimeLine, sendSegNo, wal_segment_size); sendFile = BasicOpenFile(path, O_RDONLY | PG_BINARY, 0); if (sendFile < 0) @@ -2401,8 +2401,8 @@ retry: } /* How many bytes are within this segment? */ - if (nbytes > (XLogSegSize - startoff)) - segbytes = XLogSegSize - startoff; + if (nbytes > (wal_segment_size - startoff)) + segbytes = wal_segment_size - startoff; else segbytes = nbytes; @@ -2433,7 +2433,7 @@ retry: * read() succeeds in that case, but the data we tried to read might * already have been overwritten with new WAL records. */ - XLByteToSeg(startptr, segno); + XLByteToSeg(startptr, segno, wal_segment_size); CheckXLogRemoved(segno, ThisTimeLineID); /* |