Re: Handle infinite recursion in logical replication setup
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
Cc: vignesh C <vignesh21@gmail.com>, Peter Smith <smithpb2250@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>,
"shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>, "Jonathan S. Katz" <jkatz@postgresql.org>
Date: 2022-08-17T06:33:43Z
Lists: pgsql-hackers
On Wed, Aug 17, 2022 at 8:48 AM houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com> wrote: > > On Tuesday, August 2, 2022 8:00 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Tue, Jul 26, 2022 at 9:07 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > Thanks for the summary. > > I think it's fine to make the user use the copy_data option more carefully to > prevent duplicate copies by reporting an ERROR. > > But I also have similar concern with Sawada-san as it's possible for user to > receive an ERROR in some unexpected cases. > > For example I want to build bi-directional setup between two nodes: > > Node A: TABLE test (has actual data) > Node B: TABLE test (empty) > > Step 1: > CREATE PUBLICATION on both Node A and B. > > Step 2: > CREATE SUBSCRIPTION on Node A with (copy_data = on) > -- this is fine as there is no data on Node B > > Step 3: > CREATE SUBSCRIPTION on Node B with (copy_data = on) > -- this should be fine as user needs to copy data from Node A to Node B, > -- but we still report an error for this case. > > It looks a bit strict to report an ERROR in this case and it seems not easy to > avoid this. So, personally, I think it might be better to document the correct > steps to build the bi-directional replication and probably also docuemnt the > steps to recover if user accidently did duplicate initial copy if not > documented yet. > > In addition, we could also LOG some additional information about the ORIGIN and > initial copy which might help user to analyze if needed. > But why LOG instead of WARNING? I feel in this case there is a chance of inconsistent data so a WARNING like "publication "pub1" could have data from multiple origins" can be given when the user has specified options: "copy_data = on, origin = NONE" while creating a subscription. We give a WARNING during subscription creation when the corresponding publication doesn't exist, eg. postgres=# create subscription sub1 connection 'dbname = postgres' publication pub1; WARNING: publication "pub1" does not exist in the publisher Then, we can explain in docs how users can avoid data inconsistencies while setting up replication. -- With Regards, Amit Kapila.
Commits
-
Improved CREATE SUBSCRIPTION message for clarity
- 1e7ca1189ccc 17.0 landed
- 842b65905046 16.0 landed
-
Fix the test case introduced by commit 8756930190.
- 032465157347 16.0 landed
-
Raise a warning if there is a possibility of data from multiple origins.
- 875693019053 16.0 landed
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited
-
Bump catversion for commit d8cd0c6c95c0120168df93aae095df4e0682a08a.
- 5f858dd3bebd 16.0 cited
-
Allow users to skip logical replication of data having origin.
- 366283961ac0 16.0 landed
-
Improve two comments related to a boolean DefElem's value
- 8445f5a21d40 16.0 cited
-
doc: Fix man page whitespace issues
- d7ab2a9a3c0a 15.0 cited