diff options
author | Amit Kapila <akapila@postgresql.org> | 2022-09-08 06:54:13 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2022-09-08 06:54:13 +0530 |
commit | 875693019053b8897ec3983e292acbb439b088c3 (patch) | |
tree | 75653604d83cb6339de29e5d697cae6f840820cc /doc/src | |
parent | 4b4663fb4a704b7a145ed6ec018b1f0c116eeb6b (diff) | |
download | postgresql-875693019053b8897ec3983e292acbb439b088c3.tar.gz |
Raise a warning if there is a possibility of data from multiple origins.
This commit raises a warning message for a combination of options
('copy_data = true' and 'origin = none') during CREATE/ALTER subscription
operations if the publication tables were also replicated from other
publishers.
During replication, we can skip the data from other origins as we have that
information in WAL but that is not possible during initial sync so we raise
a warning if there is such a possibility.
Author: Vignesh C
Reviewed-By: Peter Smith, Amit Kapila, Jonathan Katz, Shi yu, Wang wei
Discussion: https://www.postgresql.org/message-id/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9=9orqubhjcQ@mail.gmail.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_subscription.sgml | 5 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_subscription.sgml | 35 |
2 files changed, 40 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml index 64efc21f53..1e8d72062b 100644 --- a/doc/src/sgml/ref/alter_subscription.sgml +++ b/doc/src/sgml/ref/alter_subscription.sgml @@ -172,6 +172,11 @@ ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO < Previously subscribed tables are not copied, even if a table's row filter <literal>WHERE</literal> clause has since been modified. </para> + <para> + See <xref linkend="sql-createsubscription-notes"/> for details of + how <literal>copy_data = true</literal> can interact with the + <literal>origin</literal> parameter. + </para> </listitem> </varlistentry> </variablelist></para> diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 7390c715bc..4e001f8111 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -213,6 +213,11 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl will affect what data is copied. Refer to the <xref linkend="sql-createsubscription-notes" /> for details. </para> + <para> + See <xref linkend="sql-createsubscription-notes"/> for details of how + <literal>copy_data = true</literal> can interact with the + <literal>origin</literal> parameter. + </para> </listitem> </varlistentry> @@ -315,6 +320,11 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl to <literal>any</literal> means that the publisher sends changes regardless of their origin. The default is <literal>any</literal>. </para> + <para> + See <xref linkend="sql-createsubscription-notes"/> for details of how + <literal>copy_data = true</literal> can interact with the + <literal>origin</literal> parameter. + </para> </listitem> </varlistentry> </variablelist></para> @@ -386,6 +396,31 @@ CREATE SUBSCRIPTION <replaceable class="parameter">subscription_name</replaceabl can have non-existent publications. </para> + <para> + When using a subscription parameter combination of + <literal>copy_data = true</literal> and <literal>origin = NONE</literal>, + the initial sync table data is copied directly from the publisher, meaning + that knowledge of the true origin of that data is not possible. If the + publisher also has subscriptions then the copied table data might have + originated from further upstream. This scenario is detected and a WARNING is + logged to the user, but the warning is only an indication of a potential + problem; it is the user's responsibility to make the necessary checks to + ensure the copied data origins are really as wanted or not. + </para> + + <para> + To find which tables might potentially include non-local origins (due to + other subscriptions created on the publisher) try this SQL query: +<programlisting> +# substitute <pub-names> below with your publication name(s) to be queried +SELECT DISTINCT N.nspname AS schemaname, C.relname AS tablename +FROM pg_publication P, + LATERAL pg_get_publication_tables(P.pubname) GPT + JOIN pg_subscription_rel PS ON (GPT.relid = PS.srrelid), + pg_class C JOIN pg_namespace N ON (N.oid = C.relnamespace) +WHERE C.oid = GPT.relid AND P.pubname IN (<pub-names>); +</programlisting></para> + </refsect1> <refsect1> |