Re: Fix of fake unlogged LSN initialization

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix of fake unlogged LSN initialization
Date: 2019-10-24 08:27:45
Message-ID: CAFiTN-sDBOuxkOZHuGCXJ8Qrw4TQ0Uvj6iG6QDGyhTweESmk7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 19, 2019 at 3:18 PM tsunakawa(dot)takay(at)fujitsu(dot)com
<tsunakawa(dot)takay(at)fujitsu(dot)com> wrote:
>
> Hello,
>
>
> 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.
>

I have noticed that in StartupXlog also we reset it with 1, you might
want to fix that as well?

StartupXLOG
{
...
/*
* Initialize unlogged LSN. On a clean shutdown, it's restored from the
* control file. On recovery, all unlogged relations are blown away, so
* the unlogged LSN counter can be reset too.
*/
if (ControlFile->state == DB_SHUTDOWNED)
XLogCtl->unloggedLSN = ControlFile->unloggedLSN;
else
XLogCtl->unloggedLSN = 1;

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-10-24 09:09:52 Re: dropdb --force
Previous Message Fabien COELHO 2019-10-24 06:33:06 Re: pgbench - refactor init functions with buffers