Proposal for changes to recovery.conf API

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal for changes to recovery.conf API
Date: 2016-08-31 16:15:59
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

This is a summary of proposed changes to the recovery.conf API for
v10. These are based in part on earlier discussions, and represent a
minimal modification to current usage.

Proposed changes (with reference to patches from Abhijit Menon-Sen and myself)

* pg_ctl start -M (normal|recover|continue)
pg_ctl can now start the server directly as a standby, similar to the
way pg_ctl promote works. The internal implementation is also similar,
with pg_ctl writing a "recovery.trigger" file that initiates recovery
in the same way recovery.conf used to do. It is still possible to
manually add a file called "recovery.trigger" and have that work if
users desire that mechanism.
Different startup methods can be selected with the <option>-M</option>
option. <quote>Normal</quote> mode starts the server for read/write,
overriding any previous use in Recover mode.
<quote>Recover</quote> mode starts the server as a standby server which
expects to receive changes from a primary/master server using physical
streaming replication or is used for
performing a recovery from backup. <quote>Continue</quote> mode is
the default and will startup the server in whatever mode it was in at
last proper shutdown, or as modified by any trigger files present.
(Patch: recovery_startup_r10_api.v1b.patch)

* $DATADIR/recovery.conf no longer triggers recovery
(Patch: recovery_startup_r10_api.v1b.patch)

* Recovery parameters would now be part of the main postgresql.conf
Any parameters set in $DATADIR/recovery.conf will be read after the
main parameter file, similar to the way that is

* pg_basebackup -R will continue to generate a parameter file called
recovery.conf as it does now, but will also create a file named
(This part is WIP; patch doesn't include implementation for tar format yet)

* Parameters
All of the parameters formerly set in recovery.conf can be set in
postgresql.conf using RELOAD
These parameters will have no defaults in postgresql.conf.sample
Setting them has no effect during normal running, or once recovery ends.

Related cleanup
* Promotion signal file is now called "promote.trigger" rather than
just "promote"
* Remove user configurable "trigger_file" mechanism - use
"promote.trigger" for all cases
* Remove Fallback promote mechanism, so all promotion is now "fast" in xlog.c
* Rename CheckForStandbyTrigger() to CheckForPromoteTrigger() for clarity
(Patch: recovery_startup_r10_api.v1b.patch)

Simon Riggs
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
recovery_startup_r10_api.v1b.patch application/octet-stream 22.6 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2016-08-31 16:22:23 Re: autonomous transactions
Previous Message Andres Freund 2016-08-31 16:10:50 Re: Optimizing aggregates