mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Logical replication support for initial data copy
Add functionality for a new subscription to copy the initial data in the tables and then sync with the ongoing apply process. For the copying, add a new internal COPY option to have the COPY source data provided by a callback function. The initial data copy works on the subscriber by receiving COPY data from the publisher and then providing it locally into a COPY that writes to the destination table. A WAL receiver can now execute full SQL commands. This is used here to obtain information about tables and publications. Several new options were added to CREATE and ALTER SUBSCRIPTION to control whether and when initial table syncing happens. Change pg_dump option --no-create-subscription-slots to --no-subscription-connect and use the new CREATE SUBSCRIPTION ... NOCONNECT option for that. Author: Petr Jelinek <petr.jelinek@2ndquadrant.com> Tested-by: Erik Rijkers <er@xs4all.nl>
This commit is contained in:
@@ -31,6 +31,8 @@ CREATE SUBSCRIPTION <replaceable class="PARAMETER">subscription_name</replaceabl
|
||||
| ENABLED | DISABLED
|
||||
| CREATE SLOT | NOCREATE SLOT
|
||||
| SLOT NAME = <replaceable class="PARAMETER">slot_name</replaceable>
|
||||
| COPY DATA | NOCOPY DATA
|
||||
| NOCONNECT
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
@@ -132,6 +134,42 @@ CREATE SUBSCRIPTION <replaceable class="PARAMETER">subscription_name</replaceabl
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>COPY DATA</term>
|
||||
<term>NOCOPY DATA</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies if the existing data in the publications that are being
|
||||
subscribed to should be copied once the replication starts.
|
||||
<literal>COPY DATA</literal> is the default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>NOCONNECT</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Instructs <command>CREATE SUBSCRIPTION</command> to skip the initial
|
||||
connection to the provider. This will change default values of other
|
||||
options to <literal>DISABLED</literal>,
|
||||
<literal>NOCREATE SLOT</literal>, and <literal>NOCOPY DATA</literal>.
|
||||
</para>
|
||||
<para>
|
||||
It's not allowed to combine <literal>NOCONNECT</literal> and
|
||||
<literal>ENABLED</literal>, <literal>CREATE SLOT</literal>, or
|
||||
<literal>COPY DATA</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Since no connection is made when this option is specified, the tables
|
||||
are not subscribed, so after you enable the subscription nothing will
|
||||
be replicated. It is required to run
|
||||
<literal>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</> in order for
|
||||
tables to be subscribed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
Reference in New Issue
Block a user