Re: Function to promote standby servers
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2018-10-22T23:31:21Z
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
Commits
-
Rework documentation of pg_promote
- 74171f8c12e6 12.0 landed
-
Add pg_promote function
- 10074651e335 12.0 landed