From aa3a39d8bf0e10f3664bdb8c9ca009f17c46d30d Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilip.kumar@enterprisedb.com>
Date: Wed, 17 Aug 2022 11:15:58 +0530
Subject: [PATCH] Adjust XLogDecodeNextRecord assert to match with
 XLogBeginRead

---
 src/backend/access/transam/xlogreader.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c
index 06e9154..4c901ad 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -577,9 +577,10 @@ XLogDecodeNextRecord(XLogReaderState *state, bool nonblocking)
 		 * Caller supplied a position to start at.
 		 *
 		 * In this case, NextRecPtr should already be pointing to a valid
-		 * record starting position.
+		 * record starting position or to beginning of a page, refer comments
+		 * atop XLogBeginRead.
 		 */
-		Assert(XRecOffIsValid(RecPtr));
+		Assert(RecPtr % XLOG_BLCKSZ == 0 || XRecOffIsValid(RecPtr));
 		randAccess = true;
 	}
 
-- 
1.8.3.1

