Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2ff395c

Browse files
committed
page boundary lsn handling in RecoveryFilterLoad()
1 parent b2651f3 commit 2ff395c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/syncpoint.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "lib/stringinfo.h"
4040
#include "replication/slot.h"
4141
#include "replication/message.h"
42+
#include "access/xlog_internal.h"
4243
#include "utils/builtins.h"
4344
#include "utils/memutils.h"
4445

@@ -456,6 +457,20 @@ RecoveryFilterLoad(int filter_node_id, Syncpoint *spvector)
456457
errmsg("out of memory"),
457458
errdetail("Failed while allocating a WAL reading processor.")));
458459

460+
/*
461+
* The given start_lsn pointer points to the end of the syncpoint record,
462+
* which is not necessarily the beginning of the next record, if the
463+
* previous record happens to end at a page boundary. Skip over the page
464+
* header in that case to find the next record.
465+
*/
466+
if (start_lsn % XLOG_BLCKSZ == 0)
467+
{
468+
if (XLogSegmentOffset(start_lsn, wal_segment_size) == 0)
469+
start_lsn += SizeOfXLogLongPHD;
470+
else
471+
start_lsn += SizeOfXLogShortPHD;
472+
}
473+
459474
/* fill our filter */
460475
do
461476
{

0 commit comments

Comments
 (0)