Re: Deduplicate code updating ControleFile's DBState.

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Amul Sul <sulamul(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Deduplicate code updating ControleFile's DBState.
Date: 2021-09-21 16:13:24
Message-ID: 558D6677-69B6-4D2C-BE0A-D41049214FE2@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/20/21, 10:07 PM, "Amul Sul" <sulamul(at)gmail(dot)com> wrote:
> On Tue, Sep 21, 2021 at 4:44 AM Bossart, Nathan <bossartn(at)amazon(dot)com> wrote:
>> On 9/19/21, 11:07 PM, "Amul Sul" <sulamul(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 蔡梦娟 (玊于) 2021-09-21 16:14:49 回复:Queries that should be canceled will get stuck on secure_write function
Previous Message Tomas Vondra 2021-09-21 16:06:52 Re: proposal: possibility to read dumped table's name from file