1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-30 06:01:21 +03:00

Doc: Add the steps for upgrading the logical replication cluster.

Author: Vignesh C
Reviewed-by: Peter Smith, Amit Kapila, Hayato Kuroda, Bharath Rupireddy
Discussion: https://postgr.es/m/CALDaNm1_iDO6srWzntqTr0ZDVkk2whVhNKEWAvtgZBfSmuBeZQ@mail.gmail.com
This commit is contained in:
Amit Kapila
2024-09-25 10:06:10 +05:30
parent ba90eac7a9
commit 7fdeaf5774
3 changed files with 793 additions and 123 deletions

View File

@@ -295,6 +295,14 @@ PostgreSQL documentation
with <application>pg_upgrade</application>:
</para>
<note>
<para>
The steps to upgrade <glossterm linkend="glossary-logical-replication-cluster">logical replication clusters</glossterm>
are not covered here;
refer to <xref linkend="logical-replication-upgrade"/> for details.
</para>
</note>
<procedure>
<step performance="optional">
<title>Optionally move the old cluster</title>
@@ -396,129 +404,6 @@ make prefix=/usr/local/pgsql.new install
</para>
</step>
<step>
<title>Prepare for publisher upgrades</title>
<para>
<application>pg_upgrade</application> attempts to migrate logical
slots. This helps avoid the need for manually defining the same
logical slots on the new publisher. Migration of logical slots is
only supported when the old cluster is version 17.0 or later.
Logical slots on clusters before version 17.0 will silently be
ignored.
</para>
<para>
Before you start upgrading the publisher cluster, ensure that the
subscription is temporarily disabled, by executing
<link linkend="sql-altersubscription"><command>ALTER SUBSCRIPTION ... DISABLE</command></link>.
Re-enable the subscription after the upgrade.
</para>
<para>
There are some prerequisites for <application>pg_upgrade</application> to
be able to upgrade the logical slots. If these are not met an error
will be reported.
</para>
<itemizedlist>
<listitem>
<para>
The new cluster must have
<link linkend="guc-wal-level"><varname>wal_level</varname></link> as
<literal>logical</literal>.
</para>
</listitem>
<listitem>
<para>
The new cluster must have
<link linkend="guc-max-replication-slots"><varname>max_replication_slots</varname></link>
configured to a value greater than or equal to the number of slots
present in the old cluster.
</para>
</listitem>
<listitem>
<para>
The output plugins referenced by the slots on the old cluster must be
installed in the new PostgreSQL executable directory.
</para>
</listitem>
<listitem>
<para>
The old cluster has replicated all the transactions and logical decoding
messages to subscribers.
</para>
</listitem>
<listitem>
<para>
All slots on the old cluster must be usable, i.e., there are no slots
whose
<link linkend="view-pg-replication-slots">pg_replication_slots</link>.<structfield>conflicting</structfield>
is not <literal>true</literal>.
</para>
</listitem>
<listitem>
<para>
The new cluster must not have permanent logical slots, i.e.,
there must be no slots where
<link linkend="view-pg-replication-slots">pg_replication_slots</link>.<structfield>temporary</structfield>
is <literal>false</literal>.
</para>
</listitem>
</itemizedlist>
</step>
<step>
<title>Prepare for subscriber upgrades</title>
<para>
Setup the <link linkend="logical-replication-config-subscriber">
subscriber configurations</link> in the new subscriber.
<application>pg_upgrade</application> attempts to migrate subscription
dependencies which includes the subscription's table information present in
<link linkend="catalog-pg-subscription-rel">pg_subscription_rel</link>
system catalog and also the subscription's replication origin. This allows
logical replication on the new subscriber to continue from where the
old subscriber was up to. Migration of subscription dependencies is only
supported when the old cluster is version 17.0 or later. Subscription
dependencies on clusters before version 17.0 will silently be ignored.
</para>
<para>
There are some prerequisites for <application>pg_upgrade</application> to
be able to upgrade the subscriptions. If these are not met an error
will be reported.
</para>
<itemizedlist>
<listitem>
<para>
All the subscription tables in the old subscriber should be in state
<literal>i</literal> (initialize) or <literal>r</literal> (ready). This
can be verified by checking <link linkend="catalog-pg-subscription-rel">pg_subscription_rel</link>.<structfield>srsubstate</structfield>.
</para>
</listitem>
<listitem>
<para>
The replication origin entry corresponding to each of the subscriptions
should exist in the old cluster. This can be found by checking
<link linkend="catalog-pg-subscription">pg_subscription</link> and
<link linkend="catalog-pg-replication-origin">pg_replication_origin</link>
system tables.
</para>
</listitem>
<listitem>
<para>
The new cluster must have
<link linkend="guc-max-replication-slots"><varname>max_replication_slots</varname></link>
configured to a value greater than or equal to the number of
subscriptions present in the old cluster.
</para>
</listitem>
</itemizedlist>
</step>
<step>
<title>Stop both servers</title>