Allow reload recovery.conf during recovery - Mailing list pgsql-hackers

From Sergei Kornilov
Subject Allow reload recovery.conf during recovery
Date
Msg-id 4143811525443566@web2g.yandex.ru
Whole thread Raw
Responses Re: Allow reload recovery.conf during recovery  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: GSoC 2018: thrift encoding format
Next
From: Michael Paquier
Date:
Subject: Re: Allow reload recovery.conf during recovery