Reclassify replication-related GUC variables as "master" and "standby".

Per discussion, this structure seems more understandable than what was
there before.  Make config.sgml and postgresql.conf.sample agree.

In passing do a bit of editorial work on the variable descriptions.
This commit is contained in:
Tom Lane 2011-07-07 15:10:32 -04:00
parent 5b2b444f66
commit 60a81ad133
4 changed files with 103 additions and 72 deletions

View File

@ -1844,9 +1844,9 @@ SET ENABLE_SEQSCAN TO OFF;
<varname>archive_mode</> and <varname>archive_command</> are <varname>archive_mode</> and <varname>archive_command</> are
separate variables so that <varname>archive_command</> can be separate variables so that <varname>archive_command</> can be
changed without leaving archiving mode. changed without leaving archiving mode.
This parameter can only be set at server start. <varname>wal_level</> This parameter can only be set at server start.
must be set to <literal>archive</> or <literal>hot_standby</> to <varname>archive_mode</> cannot be enabled when
enable <varname>archive_mode</>. <varname>wal_level</> is set to <literal>minimal</>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -1911,7 +1911,10 @@ SET ENABLE_SEQSCAN TO OFF;
files. Therefore, it is unwise to use a very short files. Therefore, it is unwise to use a very short
<varname>archive_timeout</> &mdash; it will bloat your archive <varname>archive_timeout</> &mdash; it will bloat your archive
storage. <varname>archive_timeout</> settings of a minute or so are storage. <varname>archive_timeout</> settings of a minute or so are
usually reasonable. This parameter can only be set in the usually reasonable. You should consider using streaming replication,
instead of archiving, if you want data to be copied off the master
server more quickly than that.
This parameter can only be set in the
<filename>postgresql.conf</> file or on the server command line. <filename>postgresql.conf</> file or on the server command line.
</para> </para>
</listitem> </listitem>
@ -1920,14 +1923,32 @@ SET ENABLE_SEQSCAN TO OFF;
</variablelist> </variablelist>
</sect2> </sect2>
<sect2 id="runtime-config-replication"> </sect1>
<title>Streaming Replication</title>
<sect1 id="runtime-config-replication">
<title>Replication</title>
<para>
These settings control the behavior of the built-in
<firstterm>streaming replication</> feature (see
<xref linkend="streaming-replication">).
Some parameters must be set on the master server, while others must be
set on the standby server(s) that will receive replication data.
</para>
<sect2 id="runtime-config-replication-master">
<title>Master Server</title>
<para> <para>
These settings control the behavior of the built-in These parameters can be set on the primary server that is
<firstterm>streaming replication</> feature.
These parameters would be set on the primary server that is
to send replication data to one or more standby servers. to send replication data to one or more standby servers.
Note that in addition to these parameters,
<xref linkend="guc-wal-level"> must be set appropriately on the master
server, and you will typically want to enable WAL archiving as
well (see <xref linkend="runtime-config-wal-archiving">).
The values of these parameters on standby servers are irrelevant,
although you may wish to set them there in preparation for the
possibility of a standby becoming the master.
</para> </para>
<variablelist> <variablelist>
@ -1995,7 +2016,7 @@ SET ENABLE_SEQSCAN TO OFF;
<filename>pg_xlog</>; the system might need to retain more segments <filename>pg_xlog</>; the system might need to retain more segments
for WAL archival or to recover from a checkpoint. If for WAL archival or to recover from a checkpoint. If
<varname>wal_keep_segments</> is zero (the default), the system <varname>wal_keep_segments</> is zero (the default), the system
doesn't keep any extra segments for standby purposes, and the number doesn't keep any extra segments for standby purposes, so the number
of old WAL segments available to standby servers is a function of of old WAL segments available to standby servers is a function of
the location of the previous checkpoint and status of WAL the location of the previous checkpoint and status of WAL
archiving. This parameter has no effect on restartpoints. archiving. This parameter has no effect on restartpoints.
@ -2057,20 +2078,7 @@ SET ENABLE_SEQSCAN TO OFF;
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist>
</sect2>
<sect2 id="runtime-config-sync-rep">
<title>Synchronous Replication</title>
<para>
These settings control the behavior of the built-in
<firstterm>synchronous replication</> feature.
These parameters would be set on the primary server that is
to send replication data to one or more standby servers.
</para>
<variablelist>
<varlistentry id="guc-synchronous-standby-names" xreflabel="synchronous_standby_names"> <varlistentry id="guc-synchronous-standby-names" xreflabel="synchronous_standby_names">
<term><varname>synchronous_standby_names</varname> (<type>string</type>)</term> <term><varname>synchronous_standby_names</varname> (<type>string</type>)</term>
<indexterm> <indexterm>
@ -2078,29 +2086,37 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm> </indexterm>
<listitem> <listitem>
<para> <para>
Specifies a priority ordered list of standby names that can offer Specifies a comma-separated list of standby names that can support
synchronous replication. At any one time there will be at most one <firstterm>synchronous replication</>, as described in
synchronous standby that will wake sleeping users following commit. <xref linkend="synchronous-replication">.
The synchronous standby will be the first named standby that is At any one time there will be at most one active synchronous standby;
both currently connected and streaming in real-time to the standby transactions waiting for commit will be allowed to proceed after
(as shown by a state of <literal>STREAMING</literal>). Other standby servers this standby server confirms receipt of their data.
with listed later will become potential synchronous standbys. The synchronous standby will be the first standby named in this list
If the current synchronous standby disconnects for whatever reason that is both currently connected and streaming data in real-time
it will be replaced immediately with the next highest priority standby. (as shown by a state of <literal>STREAMING</literal> in the
<link linkend="monitoring-stats-views-table">
<literal>pg_stat_replication</></link> view).
Other standby servers appearing later in this list represent potential
synchronous standbys.
If the current synchronous standby disconnects for whatever reason,
it will be replaced immediately with the next-highest-priority standby.
Specifying more than one standby name can allow very high availability. Specifying more than one standby name can allow very high availability.
</para> </para>
<para> <para>
The standby name is currently taken as the <varname>application_name</> setting of the The name of a standby server for this purpose is the
standby, as set in the <varname>primary_conninfo</> on the standby. Names are <varname>application_name</> setting of the standby, as set in the
not enforced for uniqueness. In case of duplicates one of the standbys <varname>primary_conninfo</> of the standby's walreceiver. There is
will be chosen to be the synchronous standby, though exactly which no mechanism to enforce uniqueness. In case of duplicates one of the
one is indeterminate. matching standbys will be chosen to be the synchronous standby, though
The special entry <literal>*</> matches any application_name, including exactly which one is indeterminate.
the default application name of <literal>walreceiver</>. The special entry <literal>*</> matches any
<varname>application_name</>, including the default application name
of <literal>walreceiver</>.
</para> </para>
<para> <para>
If no synchronous standby names are specified, then synchronous If no synchronous standby names are specified here, then synchronous
replication is not enabled and transaction commit will never wait for replication is not enabled and transaction commits will not wait for
replication. This is the default configuration. Even when replication. This is the default configuration. Even when
synchronous replication is enabled, individual transactions can be synchronous replication is enabled, individual transactions can be
configured not to wait for replication by setting the configured not to wait for replication by setting the
@ -2117,12 +2133,13 @@ SET ENABLE_SEQSCAN TO OFF;
</variablelist> </variablelist>
</sect2> </sect2>
<sect2 id="runtime-config-standby"> <sect2 id="runtime-config-replication-standby">
<title>Standby Servers</title> <title>Standby Servers</title>
<para> <para>
These settings control the behavior of a standby server that is These settings control the behavior of a standby server that is
to receive replication data. to receive replication data. Their values on the master server
are irrelevant.
</para> </para>
<variablelist> <variablelist>
@ -2213,12 +2230,14 @@ SET ENABLE_SEQSCAN TO OFF;
<para> <para>
Specifies the minimum frequency for the WAL receiver Specifies the minimum frequency for the WAL receiver
process on the standby to send information about replication progress process on the standby to send information about replication progress
to the primary, where they can be seen using the to the primary, where it can be seen using the
<literal>pg_stat_replication</literal> view. The standby will report <link linkend="monitoring-stats-views-table">
<literal>pg_stat_replication</></link> view. The standby will report
the last transaction log position it has written, the last position it the last transaction log position it has written, the last position it
has flushed to disk, and the last position it has applied. The parameter has flushed to disk, and the last position it has applied.
This parameter's
value is the maximum interval, in seconds, between reports. Updates are value is the maximum interval, in seconds, between reports. Updates are
sent each time the write or flush positions changed, or at least as sent each time the write or flush positions change, or at least as
often as specified by this parameter. Thus, the apply position may often as specified by this parameter. Thus, the apply position may
lag slightly behind the true position. Setting this parameter to zero lag slightly behind the true position. Setting this parameter to zero
disables status updates completely. This parameter can only be set in disables status updates completely. This parameter can only be set in

View File

@ -551,10 +551,12 @@ const char *const config_group_names[] =
gettext_noop("Write-Ahead Log / Checkpoints"), gettext_noop("Write-Ahead Log / Checkpoints"),
/* WAL_ARCHIVING */ /* WAL_ARCHIVING */
gettext_noop("Write-Ahead Log / Archiving"), gettext_noop("Write-Ahead Log / Archiving"),
/* WAL_REPLICATION */ /* REPLICATION */
gettext_noop("Write-Ahead Log / Streaming Replication"), gettext_noop("Replication"),
/* WAL_STANDBY_SERVERS */ /* REPLICATION_MASTER */
gettext_noop("Write-Ahead Log / Standby Servers"), gettext_noop("Replication / Master Server"),
/* REPLICATION_STANDBY */
gettext_noop("Replication / Standby Servers"),
/* QUERY_TUNING */ /* QUERY_TUNING */
gettext_noop("Query Tuning"), gettext_noop("Query Tuning"),
/* QUERY_TUNING_METHOD */ /* QUERY_TUNING_METHOD */
@ -1357,7 +1359,7 @@ static struct config_bool ConfigureNamesBool[] =
}, },
{ {
{"hot_standby", PGC_POSTMASTER, WAL_STANDBY_SERVERS, {"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY,
gettext_noop("Allows connections and queries during recovery."), gettext_noop("Allows connections and queries during recovery."),
NULL NULL
}, },
@ -1367,7 +1369,7 @@ static struct config_bool ConfigureNamesBool[] =
}, },
{ {
{"hot_standby_feedback", PGC_SIGHUP, WAL_STANDBY_SERVERS, {"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."), gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."),
NULL NULL
}, },
@ -1534,7 +1536,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"max_standby_archive_delay", PGC_SIGHUP, WAL_STANDBY_SERVERS, {"max_standby_archive_delay", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data."), gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data."),
NULL, NULL,
GUC_UNIT_MS GUC_UNIT_MS
@ -1545,7 +1547,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"max_standby_streaming_delay", PGC_SIGHUP, WAL_STANDBY_SERVERS, {"max_standby_streaming_delay", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data."), gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data."),
NULL, NULL,
GUC_UNIT_MS GUC_UNIT_MS
@ -1556,7 +1558,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"wal_receiver_status_interval", PGC_SIGHUP, WAL_STANDBY_SERVERS, {"wal_receiver_status_interval", PGC_SIGHUP, REPLICATION_STANDBY,
gettext_noop("Sets the maximum interval between WAL receiver status reports to the primary."), gettext_noop("Sets the maximum interval between WAL receiver status reports to the primary."),
NULL, NULL,
GUC_UNIT_S GUC_UNIT_S
@ -1841,7 +1843,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"vacuum_defer_cleanup_age", PGC_SIGHUP, WAL_REPLICATION, {"vacuum_defer_cleanup_age", PGC_SIGHUP, REPLICATION_MASTER,
gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."), gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."),
NULL NULL
}, },
@ -1901,7 +1903,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"wal_keep_segments", PGC_SIGHUP, WAL_REPLICATION, {"wal_keep_segments", PGC_SIGHUP, REPLICATION_MASTER,
gettext_noop("Sets the number of WAL files held for standby servers."), gettext_noop("Sets the number of WAL files held for standby servers."),
NULL NULL
}, },
@ -1969,7 +1971,7 @@ static struct config_int ConfigureNamesInt[] =
{ {
/* see max_connections */ /* see max_connections */
{"max_wal_senders", PGC_POSTMASTER, WAL_REPLICATION, {"max_wal_senders", PGC_POSTMASTER, REPLICATION_MASTER,
gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."), gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."),
NULL NULL
}, },
@ -1979,7 +1981,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"wal_sender_delay", PGC_SIGHUP, WAL_REPLICATION, {"wal_sender_delay", PGC_SIGHUP, REPLICATION_MASTER,
gettext_noop("WAL sender sleep time between WAL replications."), gettext_noop("WAL sender sleep time between WAL replications."),
NULL, NULL,
GUC_UNIT_MS GUC_UNIT_MS
@ -1990,7 +1992,7 @@ static struct config_int ConfigureNamesInt[] =
}, },
{ {
{"replication_timeout", PGC_SIGHUP, WAL_REPLICATION, {"replication_timeout", PGC_SIGHUP, REPLICATION_MASTER,
gettext_noop("Sets the maximum time to wait for WAL replication."), gettext_noop("Sets the maximum time to wait for WAL replication."),
NULL, NULL,
GUC_UNIT_MS GUC_UNIT_MS
@ -2954,7 +2956,7 @@ static struct config_string ConfigureNamesString[] =
}, },
{ {
{"synchronous_standby_names", PGC_SIGHUP, WAL_REPLICATION, {"synchronous_standby_names", PGC_SIGHUP, REPLICATION_MASTER,
gettext_noop("List of names of potential synchronous standbys."), gettext_noop("List of names of potential synchronous standbys."),
NULL, NULL,
GUC_LIST_INPUT GUC_LIST_INPUT

View File

@ -184,32 +184,41 @@
#archive_timeout = 0 # force a logfile segment switch after this #archive_timeout = 0 # force a logfile segment switch after this
# number of seconds; 0 disables # number of seconds; 0 disables
# - Streaming Replication - Server Settings
#synchronous_standby_names = '' # standby servers that provide sync rep #------------------------------------------------------------------------------
# comma-separated list of application_name from standby(s); # REPLICATION
# '*' = all #------------------------------------------------------------------------------
# - Master Server -
# These settings are ignored on a standby server
#max_wal_senders = 0 # max number of walsender processes #max_wal_senders = 0 # max number of walsender processes
# (change requires restart) # (change requires restart)
#wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds #wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables #wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
#vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed #vacuum_defer_cleanup_age = 0 # number of xacts by which cleanup is delayed
#replication_timeout = 60s # in milliseconds, 0 is disabled #replication_timeout = 60s # in milliseconds; 0 disables
#synchronous_standby_names = '' # standby servers that provide sync rep
# comma-separated list of application_name
# from standby(s); '*' = all
# - Standby Servers - # - Standby Servers -
# These settings are ignored on a master server
#hot_standby = off # "on" allows queries during recovery #hot_standby = off # "on" allows queries during recovery
# (change requires restart) # (change requires restart)
#hot_standby_feedback = off # info from standby to prevent query conflicts
#max_standby_archive_delay = 30s # max delay before canceling queries #max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive; # when reading WAL from archive;
# -1 allows indefinite delay # -1 allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries #max_standby_streaming_delay = 30s # max delay before canceling queries
# when reading streaming WAL; # when reading streaming WAL;
# -1 allows indefinite delay # -1 allows indefinite delay
#wal_receiver_status_interval = 10s # replies at least this often, 0 disables #wal_receiver_status_interval = 10s # send replies at least this often
# 0 disables
#hot_standby_feedback = off # send info from standby to prevent
# query conflicts
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -67,8 +67,9 @@ enum config_group
WAL_SETTINGS, WAL_SETTINGS,
WAL_CHECKPOINTS, WAL_CHECKPOINTS,
WAL_ARCHIVING, WAL_ARCHIVING,
WAL_REPLICATION, REPLICATION,
WAL_STANDBY_SERVERS, REPLICATION_MASTER,
REPLICATION_STANDBY,
QUERY_TUNING, QUERY_TUNING,
QUERY_TUNING_METHOD, QUERY_TUNING_METHOD,
QUERY_TUNING_COST, QUERY_TUNING_COST,