Re: Deduplicate code updating ControleFile's DBState.

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Deduplicate code updating ControleFile's DBState.
Date: 2021-11-26 09:18:13
Message-ID: CAAJ_b94_s-VQs3Vtn_X-ReYr1DzaEakwPi80D1UYSmV3-f+_pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 26, 2021 at 12:16 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Thu, Nov 25, 2021 at 04:04:23PM +0900, Michael Paquier wrote:
> > I have not check the performance implication of that with a micro
> > benchmark or the like, but I can get behind 0001 on consistency
> > grounds between the backend and the frontend.
>
> /* Now create pg_control */
> InitControlFile(sysidentifier);
> - ControlFile->time = checkPoint.time;
> ControlFile->checkPoint = checkPoint.redo;
> ControlFile->checkPointCopy = checkPoint;
> 0001 has a mistake here, no? The initial control file creation goes
> through WriteControlFile(), and not update_controlfile(), so this
> change means that we would miss setting up this timestamp for the
> first time.
>
> @@ -714,7 +714,6 @@ GuessControlValues(void)
> ControlFile.checkPointCopy.oldestActiveXid = InvalidTransactionId;
>
> ControlFile.state = DB_SHUTDOWNED;
> - ControlFile.time = (pg_time_t) time(NULL);
> This one had better not be removed, either, as we require pg_resetwal
> to guess a set of control file values. Removing the one in
> RewriteControlFile() is fine, on the contrary.

My bad, sorry for the sloppy change, corrected it in the attached version.

Regards,
Amul

Attachment Content-Type Size
v6-0001-Do-the-ControlFile-timestamp-setting-in-update_co.patch application/x-patch 3.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-11-26 09:23:12 Re: Inconsistent results from seqscan and gist indexscan
Previous Message Daniel Gustafsson 2021-11-26 09:12:30 Re: Windows build warnings