mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
PostgreSQL 13: support "wal_keep_size"
Renamed from "wal_keep_segments" in core commit f5dff459.
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
<para>
|
||||
WAL management on the primary becomes much easier as there's no need
|
||||
to use replication slots, and <varname>wal_keep_segments</varname>
|
||||
(PostgreSQL 13 and later: <varname>wal_keep_size</varname>)
|
||||
does not need to be set.
|
||||
</para>
|
||||
</listitem>
|
||||
@@ -234,7 +235,8 @@ description = "Main cluster"
|
||||
that any standby connected to the primary using a replication slot will always
|
||||
be able to retrieve the required WAL files. This removes the need to manually
|
||||
manage WAL file retention by estimating the number of WAL files that need to
|
||||
be maintained on the primary using <varname>wal_keep_segments</varname>.
|
||||
be maintained on the primary using <varname>wal_keep_segments</varname>
|
||||
(PostgreSQL 13 and later: <varname>wal_keep_size</varname>).
|
||||
Do however be aware that if a standby is disconnected, WAL will continue to
|
||||
accumulate on the primary until either the standby reconnects or the replication
|
||||
slot is dropped.
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
|
||||
<varlistentry>
|
||||
|
||||
<term><option>wal_keep_segments</option></term>
|
||||
<term><option>wal_keep_segments</option> / <option>wal_keep_size</option></term>
|
||||
|
||||
<listitem>
|
||||
|
||||
@@ -279,25 +279,36 @@
|
||||
<secondary>PostgreSQL configuration</secondary>
|
||||
</indexterm>
|
||||
|
||||
|
||||
<indexterm>
|
||||
<primary>wal_keep_size</primary>
|
||||
<secondary>PostgreSQL configuration</secondary>
|
||||
</indexterm>
|
||||
|
||||
<para>
|
||||
Normally there is no need to set <option>wal_keep_segments</option> (default: <literal>0</literal>), as it
|
||||
is <emphasis>not</emphasis> a reliable way of ensuring that all required WAL segments are available to standbys.
|
||||
Replication slots and/or an archiving solution such as Barman are recommended to ensure standbys have a reliable
|
||||
Normally there is no need to set <option>wal_keep_segments</option>
|
||||
(PostgreSQL 13 and later: <varname>wal_keep_size</varname>; default: <literal>0</literal>),
|
||||
as it is <emphasis>not</emphasis> a reliable way of ensuring that all required WAL
|
||||
segments are available to standbys. Replication slots and/or an archiving solution
|
||||
such as Barman are recommended to ensure standbys have a reliable
|
||||
source of WAL segments at all times.
|
||||
</para>
|
||||
<para>
|
||||
The only reason ever to set <option>wal_keep_segments</option> is you have
|
||||
you have configured <option>pg_basebackup_options</option>
|
||||
The only reason ever to set <option>wal_keep_segments</option> / <option>wal_keep_size</option>
|
||||
is you have you have configured <option>pg_basebackup_options</option>
|
||||
in <filename>repmgr.conf</filename> to include the setting <literal>--wal-method=fetch</literal>
|
||||
(PostgreSQL 9.6 and earlier: <literal>--xlog-method=fetch</literal>)
|
||||
<emphasis>and</emphasis> you have <emphasis>not</emphasis> set <option>restore_command</option>
|
||||
in <filename>repmgr.conf</filename> to fetch WAL files from a reliable source such as Barman,
|
||||
in which case you'll need to set <option>wal_keep_segments</option>
|
||||
to a sufficiently high number to ensure that all WAL files required by the standby
|
||||
are retained. However we do not recommend managing replication in this way.
|
||||
are retained. However we do not recommend WAL retention in this way.
|
||||
</para>
|
||||
<para>
|
||||
PostgreSQL documentation: <ulink url="https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-WAL-KEEP-SEGMENTS">wal_keep_segments</ulink>.
|
||||
<!--
|
||||
PostgreSQL documentation: <ulink url="https://www.postgresql.org/docs/current/runtime-config-replication.html#GUC-WAL-KEEP-SIZE">wal_keep_size</ulink>.
|
||||
-->
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -175,7 +175,10 @@
|
||||
<programlisting>
|
||||
pg_basebackup_options='--wal-method=fetch'</programlisting>
|
||||
|
||||
and ensure that <literal>wal_keep_segments</literal> is set to an appropriately high value.
|
||||
and ensure that <literal>wal_keep_segments</literal> (PostgreSQL 13 and later:
|
||||
<literal>wal_keep_size</literal>) is set to an appropriately high value. Note
|
||||
however that this is not a particularly reliable way of ensuring sufficient
|
||||
WAL is retained and is not recommended.
|
||||
See the <ulink url="https://www.postgresql.org/docs/current/app-pgbasebackup.html">
|
||||
pg_basebackup</ulink> documentation for details.
|
||||
</para>
|
||||
|
||||
@@ -6068,7 +6068,7 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
|
||||
}
|
||||
/*
|
||||
* physical replication slots not available or not requested - check if
|
||||
* there are any circumstances where `wal_keep_segments` should be set
|
||||
* there are any circumstances where "wal_keep_segments" should be set
|
||||
*/
|
||||
else if (mode != barman)
|
||||
{
|
||||
@@ -6087,14 +6087,19 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
|
||||
|
||||
if (check_wal_keep_segments == true)
|
||||
{
|
||||
const char *wal_keep_parameter_name = "wal_keep_size";
|
||||
|
||||
pg_setting_ok = get_pg_setting_int(conn, "wal_keep_segments", &i);
|
||||
if (PQserverVersion(conn) < 130000)
|
||||
wal_keep_parameter_name = "wal_keep_segments";
|
||||
|
||||
pg_setting_ok = get_pg_setting_int(conn, wal_keep_parameter_name, &i);
|
||||
|
||||
if (pg_setting_ok == false || i < 1)
|
||||
{
|
||||
if (pg_setting_ok == true)
|
||||
{
|
||||
log_error(_("parameter \"wal_keep_segments\" on the upstream server must be be set to a non-zero value"));
|
||||
log_error(_("parameter \"%s\" on the upstream server must be be set to a non-zero value"),
|
||||
wal_keep_parameter_name);
|
||||
log_hint(_("Choose a value sufficiently high enough to retain enough WAL "
|
||||
"until the standby has been cloned and started.\n "
|
||||
"Alternatively set up WAL archiving using e.g. PgBarman and configure "
|
||||
@@ -6103,8 +6108,9 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
|
||||
if (server_version_num >= 90400)
|
||||
{
|
||||
log_hint(_("In PostgreSQL 9.4 and later, replication slots can be used, which "
|
||||
"do not require \"wal_keep_segments\" to be set "
|
||||
"(set parameter \"use_replication_slots\" in repmgr.conf to enable)\n"));
|
||||
"do not require \"%s\" to be set "
|
||||
"(set parameter \"use_replication_slots\" in repmgr.conf to enable)\n"),
|
||||
wal_keep_parameter_name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6119,7 +6125,9 @@ check_upstream_config(PGconn *conn, int server_version_num, t_node_info *upstrea
|
||||
|
||||
if (pg_setting_ok == true && i > 0 && runtime_options.dry_run == true)
|
||||
{
|
||||
log_info(_("parameter \"wal_keep_segments\" set to %i"), i);
|
||||
log_info(_("parameter \"%s\" set to %i"),
|
||||
wal_keep_parameter_name,
|
||||
i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user