Re: Function to promote standby servers

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function to promote standby servers
Date: 2018-10-22 23:31:21
Message-ID: 20181022233121.GB1651@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-10-23 00:11:17 Re: removing unnecessary get_att*() lsyscache functions
Previous Message Krzysztof Nienartowicz 2018-10-22 22:55:56 Re: Speeding up INSERTs and UPDATEs to partitioned tables