Обсуждение: ReadRecord wrongly assumes randAccess after 38a957316d.

Поиск
Список
Период
Сортировка

ReadRecord wrongly assumes randAccess after 38a957316d.

От
Kyotaro Horiguchi
Дата:
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.ntt@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


Re: ReadRecord wrongly assumes randAccess after 38a957316d.

От
Heikki Linnakangas
Дата:
On 28/01/2020 12:44, Kyotaro Horiguchi wrote:
> 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.

Thanks, applied!

- Heikki



Re: ReadRecord wrongly assumes randAccess after 38a957316d.

От
Kyotaro Horiguchi
Дата:
At Tue, 28 Jan 2020 13:12:05 +0200, Heikki Linnakangas <hlinnaka@iki.fi> wrote in 
> On 28/01/2020 12:44, Kyotaro Horiguchi wrote:
> > 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.
> 
> Thanks, applied!

Thanks.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center