diff options
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/catalogs.sgml | 1 | ||||
-rw-r--r-- | doc/src/sgml/logical-replication.sgml | 59 | ||||
-rw-r--r-- | doc/src/sgml/ref/alter_subscription.sgml | 18 | ||||
-rw-r--r-- | doc/src/sgml/ref/drop_subscription.sgml | 6 |
4 files changed, 60 insertions, 24 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index ea222c04640..692ad65de2d 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -7673,6 +7673,7 @@ SCRAM-SHA-256$<replaceable><iteration count></replaceable>:<replaceable>&l State code: <literal>i</literal> = initialize, <literal>d</literal> = data is being copied, + <literal>f</literal> = finished table copy, <literal>s</literal> = synchronized, <literal>r</literal> = ready (normal replication) </para></entry> diff --git a/doc/src/sgml/logical-replication.sgml b/doc/src/sgml/logical-replication.sgml index a560ad69b44..d0742f2c526 100644 --- a/doc/src/sgml/logical-replication.sgml +++ b/doc/src/sgml/logical-replication.sgml @@ -186,9 +186,10 @@ <para> Each subscription will receive changes via one replication slot (see - <xref linkend="streaming-replication-slots"/>). Additional temporary - replication slots may be required for the initial data synchronization - of pre-existing table data. + <xref linkend="streaming-replication-slots"/>). Additional replication + slots may be required for the initial data synchronization of + pre-existing table data and those will be dropped at the end of data + synchronization. </para> <para> @@ -248,13 +249,23 @@ <para> As mentioned earlier, each (active) subscription receives changes from a - replication slot on the remote (publishing) side. Normally, the remote - replication slot is created automatically when the subscription is created - using <command>CREATE SUBSCRIPTION</command> and it is dropped - automatically when the subscription is dropped using <command>DROP - SUBSCRIPTION</command>. In some situations, however, it can be useful or - necessary to manipulate the subscription and the underlying replication - slot separately. Here are some scenarios: + replication slot on the remote (publishing) side. + </para> + <para> + Additional table synchronization slots are normally transient, created + internally to perform initial table synchronization and dropped + automatically when they are no longer needed. These table synchronization + slots have generated names: <quote><literal>pg_%u_sync_%u_%llu</literal></quote> + (parameters: Subscription <parameter>oid</parameter>, + Table <parameter>relid</parameter>, system identifier <parameter>sysid</parameter>) + </para> + <para> + Normally, the remote replication slot is created automatically when the + subscription is created using <command>CREATE SUBSCRIPTION</command> and it + is dropped automatically when the subscription is dropped using + <command>DROP SUBSCRIPTION</command>. In some situations, however, it can + be useful or necessary to manipulate the subscription and the underlying + replication slot separately. Here are some scenarios: <itemizedlist> <listitem> @@ -294,8 +305,9 @@ using <command>ALTER SUBSCRIPTION</command> before attempting to drop the subscription. If the remote database instance no longer exists, no further action is then necessary. If, however, the remote database - instance is just unreachable, the replication slot should then be - dropped manually; otherwise it would continue to reserve WAL and might + instance is just unreachable, the replication slot (and any still + remaining table synchronization slots) should then be + dropped manually; otherwise it/they would continue to reserve WAL and might eventually cause the disk to fill up. Such cases should be carefully investigated. </para> @@ -468,16 +480,19 @@ <sect2 id="logical-replication-snapshot"> <title>Initial Snapshot</title> <para> - The initial data in existing subscribed tables are snapshotted and - copied in a parallel instance of a special kind of apply process. - This process will create its own temporary replication slot and - copy the existing data. Once existing data is copied, the worker - enters synchronization mode, which ensures that the table is brought - up to a synchronized state with the main apply process by streaming - any changes that happened during the initial data copy using standard - logical replication. Once the synchronization is done, the control - of the replication of the table is given back to the main apply - process where the replication continues as normal. + The initial data in existing subscribed tables are snapshotted and + copied in a parallel instance of a special kind of apply process. + This process will create its own replication slot and copy the existing + data. As soon as the copy is finished the table contents will become + visible to other backends. Once existing data is copied, the worker + enters synchronization mode, which ensures that the table is brought + up to a synchronized state with the main apply process by streaming + any changes that happened during the initial data copy using standard + logical replication. During this synchronization phase, the changes + are applied and committed in the same order as they happened on the + publisher. Once the synchronization is done, the control of the + replication of the table is given back to the main apply process where + the replication continues as normal. </para> </sect2> </sect1> diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml index db5e59f707c..bcb0acf28d8 100644 --- a/doc/src/sgml/ref/alter_subscription.sgml +++ b/doc/src/sgml/ref/alter_subscription.sgml @@ -48,6 +48,24 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO < (Currently, all subscription owners must be superusers, so the owner checks will be bypassed in practice. But this might change in the future.) </para> + + <para> + When refreshing a publication we remove the relations that are no longer + part of the publication and we also remove the tablesync slots if there are + any. It is necessary to remove tablesync slots so that the resources + allocated for the subscription on the remote host are released. If due to + network breakdown or some other error, <productname>PostgreSQL</productname> + is unable to remove the slots, an ERROR will be reported. To proceed in this + situation, either the user need to retry the operation or disassociate the + slot from the subscription and drop the subscription as explained in + <xref linkend="sql-dropsubscription"/>. + </para> + + <para> + Commands <command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command> and + <command>ALTER SUBSCRIPTION ... SET PUBLICATION ...</command> with refresh + option as true cannot be executed inside a transaction block. + </para> </refsect1> <refsect1> diff --git a/doc/src/sgml/ref/drop_subscription.sgml b/doc/src/sgml/ref/drop_subscription.sgml index adbdeafb4e1..aee96155463 100644 --- a/doc/src/sgml/ref/drop_subscription.sgml +++ b/doc/src/sgml/ref/drop_subscription.sgml @@ -79,7 +79,8 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable <para> When dropping a subscription that is associated with a replication slot on the remote host (the normal state), <command>DROP SUBSCRIPTION</command> - will connect to the remote host and try to drop the replication slot as + will connect to the remote host and try to drop the replication slot (and + any remaining table synchronization slots) as part of its operation. This is necessary so that the resources allocated for the subscription on the remote host are released. If this fails, either because the remote host is not reachable or because the remote @@ -89,7 +90,8 @@ DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>. After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any actions on a remote host. Note that if the remote replication slot still - exists, it should then be dropped manually; otherwise it will continue to + exists, it (and any related table synchronization slots) should then be + dropped manually; otherwise it/they will continue to reserve WAL and might eventually cause the disk to fill up. See also <xref linkend="logical-replication-subscription-slot"/>. </para> |