Hello. While rebasing a patch, I found that after the commit 38a957316d (Sorry for overlooking that.), ReadRecord sets randAccess reverse way. That is, it sets randAccess to false just after a XLogBeginRead() call. The attached fixes that.
regards. -- Kyotaro Horiguchi NTT Open Source Software Center
>From 504600f918376f36d8d4d3ccb34e5d004ef8b4df Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota....@gmail.com> Date: Tue, 28 Jan 2020 18:58:05 +0900 Subject: [PATCH] Fix randAccess setting in ReadRecrod Before the commit 38a957316d, the function assumes random access at the initial state, on which a valid LSN is given as RecPtr. After the commit XLogBeginRead initializes reader state by setting ReadRecPtr to invalid. However ReadRecord was wrongly changed so that a valid ReadRecPtr is assumed as the initial state. Fix it. --- src/backend/access/transam/xlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 882d5e8a73..6e09ded597 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4265,7 +4265,7 @@ ReadRecord(XLogReaderState *xlogreader, int emode, /* Pass through parameters to XLogPageRead */ private->fetching_ckpt = fetching_ckpt; private->emode = emode; - private->randAccess = (xlogreader->ReadRecPtr != InvalidXLogRecPtr); + private->randAccess = (xlogreader->ReadRecPtr == InvalidXLogRecPtr); /* This is the first attempt to read this page. */ lastSourceFailed = false; -- 2.18.2