Re: Function to promote standby servers - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Function to promote standby servers
Date
Msg-id 20181022233121.GB1651@paquier.xyz
Whole thread Raw
In response to Re: Function to promote standby servers  (Laurenz Albe <laurenz.albe@cybertec.at>)
Responses Re: Function to promote standby servers
List pgsql-hackers
On Mon, Oct 22, 2018 at 11:45:30AM +0200, Laurenz Albe wrote:
> Masahiko Sawada wrote:
>> Thank you for workig on this. There is one review comment for the latest patch.
>>
>> +     if (FreeFile(promote_file))
>> +               ereport(ERROR,
>> +                               (errcode_for_file_access(),
>> +                                errmsg("could not write file \"%s\": %m",
>> +                                               PROMOTE_SIGNAL_FILE)));
>>
>> Maybe we should unlink PROMOTE_SIGNAL_FILE before erroring.
>
> Yes, that cannot hurt.

If FreeFile() fails, unlink() would most likely fail for the same
reason.  Please note that if unlink() happens before issuing the ERROR,
saving errno would be necessary.  That's not a huge issue anyway, if a
failure happens, the operator would retry the operation.  If there is a
crash, the file gets removed at the end of recovery.  If there are no
objections, I'll look at this patch again by the end of this week in
order to get it committed.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Krzysztof Nienartowicz
Date:
Subject: Re: Speeding up INSERTs and UPDATEs to partitioned tables
Next
From: Michael Paquier
Date:
Subject: Re: removing unnecessary get_att*() lsyscache functions