From 875693019053b8897ec3983e292acbb439b088c3 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Thu, 8 Sep 2022 06:54:13 +0530 Subject: 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 --- doc/src/sgml/ref/alter_subscription.sgml | 5 +++++ doc/src/sgml/ref/create_subscription.sgml | 35 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/alter_subscription.sgml b/doc/src/sgml/ref/alter_subscription.sgml index 64efc21f537..1e8d72062b3 100644 --- a/doc/src/sgml/ref/alter_subscription.sgml +++ b/doc/src/sgml/ref/alter_subscription.sgml @@ -172,6 +172,11 @@ ALTER SUBSCRIPTION name RENAME TO < Previously subscribed tables are not copied, even if a table's row filter WHERE clause has since been modified. + + See for details of + how copy_data = true can interact with the + origin parameter. + diff --git a/doc/src/sgml/ref/create_subscription.sgml b/doc/src/sgml/ref/create_subscription.sgml index 7390c715bc3..4e001f81119 100644 --- a/doc/src/sgml/ref/create_subscription.sgml +++ b/doc/src/sgml/ref/create_subscription.sgml @@ -213,6 +213,11 @@ CREATE SUBSCRIPTION subscription_name for details. + + See for details of how + copy_data = true can interact with the + origin parameter. + @@ -315,6 +320,11 @@ CREATE SUBSCRIPTION subscription_nameany means that the publisher sends changes regardless of their origin. The default is any. + + See for details of how + copy_data = true can interact with the + origin parameter. + @@ -386,6 +396,31 @@ CREATE SUBSCRIPTION subscription_name + + When using a subscription parameter combination of + copy_data = true and origin = NONE, + 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. + + + + To find which tables might potentially include non-local origins (due to + other subscriptions created on the publisher) try this SQL query: + +# 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>); + + -- cgit v1.2.3