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
separate variables so that <varname>archive_command</> can be
changed without leaving archiving mode.
This parameter can only be set at server start. <varname>wal_level</>
must be set to <literal>archive</> or <literal>hot_standby</> to
enable <varname>archive_mode</>.
This parameter can only be set at server start.
<varname>archive_mode</> cannot be enabled when
<varname>wal_level</> is set to <literal>minimal</>.
</para>
</listitem>
</varlistentry>
@ -1911,7 +1911,10 @@ SET ENABLE_SEQSCAN TO OFF;
files. Therefore, it is unwise to use a very short
<varname>archive_timeout</> &mdash; it will bloat your archive
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.
</para>
</listitem>
@ -1920,14 +1923,32 @@ SET ENABLE_SEQSCAN TO OFF;
</variablelist>
</sect2>
<sect2 id="runtime-config-replication">
<title>Streaming Replication</title>
</sect1>
<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>
These settings control the behavior of the built-in
<firstterm>streaming replication</> feature.
These parameters would be set on the primary server that is
These parameters can be set on the primary server that is
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>
<variablelist>
@ -1995,7 +2016,7 @@ SET ENABLE_SEQSCAN TO OFF;
<filename>pg_xlog</>; the system might need to retain more segments
for WAL archival or to recover from a checkpoint. If
<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
the location of the previous checkpoint and status of WAL
archiving. This parameter has no effect on restartpoints.
@ -2057,20 +2078,7 @@ SET ENABLE_SEQSCAN TO OFF;
</para>
</listitem>
</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">
<term><varname>synchronous_standby_names</varname> (<type>string</type>)</term>
<indexterm>
@ -2078,29 +2086,37 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm>
<listitem>
<para>
Specifies a priority ordered list of standby names that can offer
synchronous replication. At any one time there will be at most one
synchronous standby that will wake sleeping users following commit.
The synchronous standby will be the first named standby that is
both currently connected and streaming in real-time to the standby
(as shown by a state of <literal>STREAMING</literal>). Other standby servers
with listed later will become potential synchronous standbys.
If the current synchronous standby disconnects for whatever reason
it will be replaced immediately with the next highest priority standby.
Specifies a comma-separated list of standby names that can support
<firstterm>synchronous replication</>, as described in
<xref linkend="synchronous-replication">.
At any one time there will be at most one active synchronous standby;
transactions waiting for commit will be allowed to proceed after
this standby server confirms receipt of their data.
The synchronous standby will be the first standby named in this list
that is both currently connected and streaming data in real-time
(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.
</para>
<para>
The standby name is currently taken as the <varname>application_name</> setting of the
standby, as set in the <varname>primary_conninfo</> on the standby. Names are
not enforced for uniqueness. In case of duplicates one of the standbys
will be chosen to be the synchronous standby, though exactly which
one is indeterminate.
The special entry <literal>*</> matches any application_name, including
the default application name of <literal>walreceiver</>.
The name of a standby server for this purpose is the
<varname>application_name</> setting of the standby, as set in the
<varname>primary_conninfo</> of the standby's walreceiver. There is
no mechanism to enforce uniqueness. In case of duplicates one of the
matching standbys will be chosen to be the synchronous standby, though
exactly which one is indeterminate.
The special entry <literal>*</> matches any
<varname>application_name</>, including the default application name
of <literal>walreceiver</>.
</para>
<para>
If no synchronous standby names are specified, then synchronous
replication is not enabled and transaction commit will never wait for
If no synchronous standby names are specified here, then synchronous
replication is not enabled and transaction commits will not wait for
replication. This is the default configuration. Even when
synchronous replication is enabled, individual transactions can be
configured not to wait for replication by setting the
@ -2117,12 +2133,13 @@ SET ENABLE_SEQSCAN TO OFF;
</variablelist>
</sect2>
<sect2 id="runtime-config-standby">
<title>Standby Servers</title>
<sect2 id="runtime-config-replication-standby">
<title>Standby Servers</title>
<para>
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>
<variablelist>
@ -2213,12 +2230,14 @@ SET ENABLE_SEQSCAN TO OFF;
<para>
Specifies the minimum frequency for the WAL receiver
process on the standby to send information about replication progress
to the primary, where they can be seen using the
<literal>pg_stat_replication</literal> view. The standby will report
to the primary, where it can be seen using the
<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
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
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
lag slightly behind the true position. Setting this parameter to zero
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"),
/* WAL_ARCHIVING */
gettext_noop("Write-Ahead Log / Archiving"),
/* WAL_REPLICATION */
gettext_noop("Write-Ahead Log / Streaming Replication"),
/* WAL_STANDBY_SERVERS */
gettext_noop("Write-Ahead Log / Standby Servers"),
/* REPLICATION */
gettext_noop("Replication"),
/* REPLICATION_MASTER */
gettext_noop("Replication / Master Server"),
/* REPLICATION_STANDBY */
gettext_noop("Replication / Standby Servers"),
/* QUERY_TUNING */
gettext_noop("Query Tuning"),
/* 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."),
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."),
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."),
NULL,
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."),
NULL,
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."),
NULL,
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."),
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."),
NULL
},
@ -1969,7 +1971,7 @@ static struct config_int ConfigureNamesInt[] =
{
/* 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."),
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."),
NULL,
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."),
NULL,
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."),
NULL,
GUC_LIST_INPUT

View File

@ -184,32 +184,41 @@
#archive_timeout = 0 # force a logfile segment switch after this
# 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);
# '*' = all
#------------------------------------------------------------------------------
# REPLICATION
#------------------------------------------------------------------------------
# - Master Server -
# These settings are ignored on a standby server
#max_wal_senders = 0 # max number of walsender processes
# (change requires restart)
#wal_sender_delay = 1s # walsender cycle time, 1-10000 milliseconds
#wal_keep_segments = 0 # in logfile segments, 16MB each; 0 disables
#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 -
# These settings are ignored on a master server
#hot_standby = off # "on" allows queries during recovery
# (change requires restart)
#hot_standby_feedback = off # info from standby to prevent query conflicts
#max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive;
# -1 allows indefinite delay
#max_standby_streaming_delay = 30s # max delay before canceling queries
# when reading streaming WAL;
# -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_CHECKPOINTS,
WAL_ARCHIVING,
WAL_REPLICATION,
WAL_STANDBY_SERVERS,
REPLICATION,
REPLICATION_MASTER,
REPLICATION_STANDBY,
QUERY_TUNING,
QUERY_TUNING_METHOD,
QUERY_TUNING_COST,