Re: Deduplicate code updating ControleFile's DBState. - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: Deduplicate code updating ControleFile's DBState.
Date
Msg-id 558D6677-69B6-4D2C-BE0A-D41049214FE2@amazon.com
Whole thread Raw
In response to Re: Deduplicate code updating ControleFile's DBState.  (Amul Sul <sulamul@gmail.com>)
Responses Re: Deduplicate code updating ControleFile's DBState.  (Amul Sul <sulamul@gmail.com>)
List pgsql-hackers
On 9/20/21, 10:07 PM, "Amul Sul" <sulamul@gmail.com> wrote:
> On Tue, Sep 21, 2021 at 4:44 AM Bossart, Nathan <bossartn@amazon.com> wrote:
>> On 9/19/21, 11:07 PM, "Amul Sul" <sulamul@gmail.com> wrote:
>> > I have one additional concern about the way we update the control
>> > file, at every place where doing the update, we need to set control
>> > file update time explicitly, why can't the time update line be moved
>> > to UpdateControlFile() so that time gets automatically updated?
>>
>> I see a few places where UpdateControlFile() is called without
>> updating ControlFile->time.  I haven't found any obvious reason for
>> that, so perhaps it would be okay to move it to update_controlfile().
>>
>
> Ok, thanks, did the same in the attached version.

void
UpdateControlFile(void)
{
+    ControlFile->time = (pg_time_t) time(NULL);
    update_controlfile(DataDir, ControlFile, true);
}

Shouldn't we update the time in update_controlfile()?  Also, can you
split this change into two patches (i.e., one for the timestamp change
and another for the refactoring)?  Otherwise, this looks reasonable to
me.

Nathan


pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: proposal: possibility to read dumped table's name from file
Next
From: "蔡梦娟(玊于)"
Date:
Subject: 回复:Queries that should be canceled will get stuck on secure_write function