Re: Fix of fake unlogged LSN initialization - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Fix of fake unlogged LSN initialization
Date
Msg-id 20191021050347.GB2609@paquier.xyz
Whole thread Raw
In response to Fix of fake unlogged LSN initialization  ("tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>)
Responses Re: Fix of fake unlogged LSN initialization
Re: Fix of fake unlogged LSN initialization
List pgsql-hackers
On Sat, Oct 19, 2019 at 05:03:00AM +0000, tsunakawa.takay@fujitsu.com wrote:
> The attached trivial patch fixes the initialization of the fake
> unlogged LSN.  Currently, BootstrapXLOG() in initdb sets the initial
> fake unlogged LSN to FirstNormalUnloggedLSN (=1000), but the
> recovery and pg_resetwal sets it to 1.  The patch modifies the
> latter two cases to match initdb.
>
> I don't know if this do actual harm, because the description of
> FirstNormalUnloggedLSN doesn't give me any idea.

From xlogdefs.h added by 9155580:
/*
 * First LSN to use for "fake" LSNs.
 *
 * Values smaller than this can be used for special per-AM purposes.
 */
#define FirstNormalUnloggedLSN  ((XLogRecPtr) 1000)

So it seems to me that you have caught a bug here, and that we had
better back-patch to v12 so as recovery and pg_resetwal don't mess up
with AMs using lower values than that.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Missing error_context_stack = NULL in AutoVacWorkerMain()
Next
From: Amit Kapila
Date:
Subject: Re: dropdb --force