1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Merge wal_level "archive" and "hot_standby" into new name "replica"

The distinction between "archive" and "hot_standby" existed only because
at the time "hot_standby" was added, there was some uncertainty about
stability.  This is now a long time ago.  We would like to move forward
with simplifying the replication configuration, but this distinction is
in the way, because a primary server cannot tell (without asking a
standby or predicting the future) which one of these would be the
appropriate level.

Pick a new name for the combined setting to make it clearer that it
covers all (non-logical) backup and replication uses.  The old values
are still accepted but are converted internally.

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Reviewed-by: David Steele <david@pgmasters.net>
This commit is contained in:
Peter Eisentraut
2016-02-29 20:01:54 -05:00
parent 4e1d2a1708
commit b555ed8102
17 changed files with 44 additions and 54 deletions

View File

@ -592,7 +592,7 @@ tar -cf backup.tar /usr/local/pgsql/data
<para>
To enable WAL archiving, set the <xref linkend="guc-wal-level">
configuration parameter to <literal>archive</> or higher,
configuration parameter to <literal>replica</> or higher,
<xref linkend="guc-archive-mode"> to <literal>on</>,
and specify the shell command to use in the <xref
linkend="guc-archive-command"> configuration parameter. In practice
@ -1285,7 +1285,7 @@ restore_command = 'cp /mnt/server/archivedir/%f %p'
If more flexibility in copying the backup files is needed, a lower
level process can be used for standalone hot backups as well.
To prepare for low level standalone hot backups, set <varname>wal_level</> to
<literal>archive</> or higher, <varname>archive_mode</> to
<literal>replica</> or higher, <varname>archive_mode</> to
<literal>on</>, and set up an <varname>archive_command</> that performs
archiving only when a <emphasis>switch file</> exists. For example:
<programlisting>

View File

@ -2029,9 +2029,9 @@ include_dir 'conf.d'
<varname>wal_level</> determines how much information is written
to the WAL. The default value is <literal>minimal</>, which writes
only the information needed to recover from a crash or immediate
shutdown. <literal>archive</> adds logging required for WAL archiving;
<literal>hot_standby</> further adds information required to run
read-only queries on a standby server; and, finally
shutdown. <literal>replica</> adds logging required for WAL
archiving as well as information required to run
read-only queries on a standby server. Finally,
<literal>logical</> adds information necessary to support logical
decoding. Each level includes the information logged at all lower
levels. This parameter can only be set at server start.
@ -2049,30 +2049,24 @@ include_dir 'conf.d'
transaction</member>
</simplelist>
But minimal WAL does not contain enough information to reconstruct the
data from a base backup and the WAL logs, so <literal>archive</> or
data from a base backup and the WAL logs, so <literal>replica</> or
higher must be used to enable WAL archiving
(<xref linkend="guc-archive-mode">) and streaming replication.
</para>
<para>
In <literal>hot_standby</> level, the same information is logged as
with <literal>archive</>, plus information needed to reconstruct
the status of running transactions from the WAL. To enable read-only
queries on a standby server, <varname>wal_level</> must be set to
<literal>hot_standby</> or higher on the primary, and
<xref linkend="guc-hot-standby"> must be enabled in the standby. It is
thought that there is little measurable difference in performance
between using <literal>hot_standby</> and <literal>archive</> levels,
so feedback is welcome if any production impacts are noticeable.
</para>
<para>
In <literal>logical</> level, the same information is logged as
with <literal>hot_standby</>, plus information needed to allow
with <literal>replica</>, plus information needed to allow
extracting logical change sets from the WAL. Using a level of
<literal>logical</> will increase the WAL volume, particularly if many
tables are configured for <literal>REPLICA IDENTITY FULL</literal> and
many <command>UPDATE</> and <command>DELETE</> statements are
executed.
</para>
<para>
In releases prior to 9.6, this parameter also allowed the
values <literal>archive</literal> and <literal>hot_standby</literal>.
These are still accepted but mapped to <literal>replica</literal>.
</para>
</listitem>
</varlistentry>
@ -2784,7 +2778,7 @@ include_dir 'conf.d'
higher than the maximum number of expected clients so disconnected
clients can immediately reconnect. This parameter can only
be set at server start. <varname>wal_level</> must be set to
<literal>archive</> or higher to allow connections from standby
<literal>replica</> or higher to allow connections from standby
servers.
</para>
</listitem>
@ -2803,7 +2797,7 @@ include_dir 'conf.d'
can support. The default is zero. This parameter can only be set at
server start.
<varname>wal_level</varname> must be set
to <literal>archive</literal> or higher to allow replication slots to
to <literal>replica</literal> or higher to allow replication slots to
be used. Setting it to a lower value than the number of currently
existing replication slots will prevent the server from starting.
</para>

View File

@ -1988,7 +1988,7 @@ LOG: database system is ready to accept read only connections
Consistency information is recorded once per checkpoint on the primary.
It is not possible to enable hot standby when reading WAL
written during a period when <varname>wal_level</> was not set to
<literal>hot_standby</> or <literal>logical</> on the primary. Reaching
<literal>replica</> or <literal>logical</> on the primary. Reaching
a consistent state can also be delayed in the presence of both of these
conditions:

View File

@ -108,7 +108,7 @@ ALTER SYSTEM RESET ALL
<para>
Set the <literal>wal_level</>:
<programlisting>
ALTER SYSTEM SET wal_level = hot_standby;
ALTER SYSTEM SET wal_level = replica;
</programlisting>
</para>

View File

@ -477,7 +477,7 @@ pg_upgrade.exe
<para>
In the new master cluster, change <varname>wal_level</> to
<literal>hot_standby</> in the <filename>postgresql.conf</> file
<literal>replica</> in the <filename>postgresql.conf</> file
and then start and stop the cluster.
</para>
</step>