Re: Deduplicate code updating ControleFile's DBState.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Amul Sul <sulamul(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Deduplicate code updating ControleFile's DBState.
Date: 2021-10-02 05:40:16
Message-ID: YVfwwIlBKbgsDsne@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 01, 2021 at 05:47:45PM +0000, Bossart, Nathan wrote:
> I'm inclined to agree that anything that calls update_controlfile()
> should update the timestamp.

pg_control.h tells that:
pg_time_t time; /* time stamp of last pg_control update */
So, yes, that would be more consistent.

> However, I wonder if the additional
> calls to time() would have a noticeable impact.

I would not take that lightly either. Now, I don't think that any of
the code paths where UpdateControlFile() or update_controlfile() is
called are hot enough to worry about that.

UpdateControlFile(void)
{
+ ControlFile->time = (pg_time_t) time(NULL);
update_controlfile(DataDir, ControlFile, true);
}
I have to admit that it is a bit strange to do that in the backend but
not the frontend, so there is a good argument for doing that directly
in update_controlfile(). pg_resetwal does an update of the time, but
pg_rewind does not.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Erik Rijkers 2021-10-02 06:18:14 Re: proposal: possibility to read dumped table's name from file
Previous Message Michael Paquier 2021-10-02 05:30:51 Re: 2021-09 Commitfest