Allow reload recovery.conf during recovery

From: Sergei Kornilov <sk(at)zsrv(dot)org>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Allow reload recovery.conf during recovery
Date: 2018-05-04 14:19:26
Message-ID: 4143811525443566@web2g.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all
I want propose patch to make possible change primary_conninfo, primary_slot_name, restore_command and trigger_file in recovery.conf without 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 master we 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 all we 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 standard restart)
trigger_file was not my primary target, but i not find any reason to decline this change on reload (also did not find any tests with trigger_file, i add one). I am not sure about all other settings like recovery_min_apply_delay, archive_cleanup_command and 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 Content-Type Size
allow_reload_recovery_conf_v1.patch text/x-diff 48.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Blackwell 2018-05-04 14:30:05 Re: pgsql: Fix precedence problem in new Perl code.
Previous Message Stephen Frost 2018-05-04 14:01:40 Re: GSoC 2018: thrift encoding format