Обсуждение: Allow reload recovery.conf during recovery

Поиск
Список
Период
Сортировка

Allow reload recovery.conf during recovery

От
Sergei Kornilov
Дата:
Hello all
I want propose patch to make possible change primary_conninfo, primary_slot_name, restore_command and trigger_file in
recovery.confwithout restart postgresql.
 
Startup process will reread recovery.conf on SIGHUP.

My primary usecase is postgresql cluster with streaming replication. When we lost current master and want promote new
masterwe need restart all replicas with new primary_conninfo.
 
Another useful cases from my work:
- switch wal streaming to another NIC
- change replication username (or password when .pgpass was not used)
When restarting, shared buffers are lost; some time are spent in recovery from last restart point. But in some cases
allwe need is to change connection string.
 
Changing restore_command may be useful for users too.

I did not find previous discussions.

I split readRecoveryCommandFile to two functions:
- readRecoveryCommandFile with reading and validating recovery.conf and avoid side effects
- ProcessRecoveryCommandFile with other logic

Changing primary_conninfo or primary_slot_name will restart walreceiver (i do not touch walreceiver source, i request
standardrestart)
 
trigger_file was not my primary target, but i not find any reason to decline this change on reload (also did not find
anytests with trigger_file, i add one). I am not sure about all other settings like recovery_min_apply_delay,
archive_cleanup_commandand etc, so i forbid these changes.
 

Patch to current master. Changes to the documentation and a few additional tests are included.

PS: of course, i do not mean postgresql 11

regards, Sergei
Вложения

Re: Allow reload recovery.conf during recovery

От
Michael Paquier
Дата:
On Fri, May 04, 2018 at 05:19:26PM +0300, Sergei Kornilov wrote:
> I did not find previous discussions.

There have been a lot of discussions across the years about switching
recovery parameters to use the GUC infrastructure, please see those
two ones:
https://www.postgresql.org/message-id/CABUevEy5aWuwySXEC6i3JA6cvy8agGZHQbOn0RVZ4h4oxM0Dkw%40mail.gmail.com
https://www.postgresql.org/message-id/CAJKUy5id1eyweK0W4%2ByyCM6%2B-qYs9erLidUmb%3D1a-QYBgTW4Qw%40mail.gmail.com

And more recently this one which reached a kind of agreement:
https://www.postgresql.org/message-id/CANP8%2BjLO5fmfudbB1b1iw3pTdOK1HBM%3DxMTaRfOa5zpDVcqzew%40mail.gmail.com

Parameters in recovery.conf now have a level equivalent to
GUC_POSTMASTER as those are just read when the startup process finds a
recovery.conf file and are never changed.  Before making some of them as
reloadable, let's switch them to be GUCs first and not re-invent the
SIGHUP handling of parameters as your patch does.  And after let's
discuss about switching some of them to GUC_SIGHUP.
--
Michael

Вложения

Re: Allow reload recovery.conf during recovery

От
Sergei Kornilov
Дата:
Hello Michael
Thank you, i understand your opinion.
I really tried to find a discussion about reload recovery.conf (or walreceiver conninfo changing and similar stuff),
notabout GUC.
 

regards, Sergei