Re: standby promotion can create unreadable WAL - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: standby promotion can create unreadable WAL
Date
Msg-id 20220829.131352.1390194912445731838.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: standby promotion can create unreadable WAL  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: standby promotion can create unreadable WAL
List pgsql-hackers
At Sun, 28 Aug 2022 10:16:21 +0530, Dilip Kumar <dilipbalaut@gmail.com> wrote in 
> On Fri, Aug 26, 2022 at 7:53 PM Robert Haas <robertmhaas@gmail.com> wrote:
> > v2 attached.
> 
> The patch LGTM, this patch will apply on master and v15.  PFA patch
> for back branches.

StandbyMode is obviously wrong.  On the other hand I thought that
!ArchiveRecoveryRequested is somewhat wrong, too (, as I stated in the
pointed thread).  On second thought, I changed my mind that it is
right. After aborted contrec is found, The cause of the confusion is
that I somehow thought that archive recovery continues from the
aborted-contrec record.  However, that assumption is wrong. The next
redo starts from the beginning of the aborted contrecord so we should
forget abouat the old missing/aborted contrec info when archive
recovery is requested.

In the end, the point is that we need to set the global variables only
when XLogPrefetcherReadRecord() (or XLogReadRecord()) returns NULL and
we return it to the caller.  Is it worth to do a small refactoring
like the attached?  If no, I'm fine with the proposed patch including
the added assertion.

# I havent reproduce the issue of the OP in the other thread yet, and
# also not found how to reproduce this issue, though..

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Attachment

pgsql-hackers by date:

Previous
From: "kuroda.hayato@fujitsu.com"
Date:
Subject: patch: Add missing descriptions for rmgr APIs
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: standby promotion can create unreadable WAL