Re: Handle infinite recursion in logical replication setup
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: vignesh C <vignesh21@gmail.com>,
Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, "kuroda.hayato@fujitsu.com" <kuroda.hayato@fujitsu.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-03-08T07:54:47Z
Lists: pgsql-hackers
On Tue, Mar 8, 2022 at 12:17 PM Peter Smith <smithpb2250@gmail.com> wrote: > > On Tue, Mar 8, 2022 at 4:21 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > On Tue, Mar 8, 2022 at 10:31 AM Peter Smith <smithpb2250@gmail.com> wrote: > > > > > > IIUC the new option may be implemented subscriber-side and/or > > > publisher-side and/or both, and the subscriber-side option may be > > > "enhanced" in future to prevent cycles. And probably there are more > > > features I don't know about or that have not yet been thought of. > > > > > > ~~ > > > > > > Even if the plan is only to implement just one part now and then add > > > more later, I think there still should be some consideration for what > > > you expect all possible future options to look like, because that may > > > affect current implementation choices. > > > > > > The point is: > > > > > > - we should take care so don't accidentally end up with an option that > > > turned out to be inconsistent looking on the subscriber-side / > > > publisher-side. > > > > > > - we should try to avoid accidentally painting ourselves into a corner > > > (e.g. stuck with a boolean option that cannot be enhanced later on) > > > > > > > Agreed. I think it is important to see we shouldn't do something which > > is not extendable in future or paint us in the corner. But, as of now, > > with the current proposal, the main thing we should consider is > > whether exposing the boolean option is okay or shall we do something > > different so that we can extend it later to specific origin ids? > > > > I was wondering, assuming later there is an enhancement to detect and > prevent cycles using origin ids, then what really is the purpose of > the option? > We can't use origin ids during the initial sync as we can't differentiate between data from local or remote node. Also, how will we distinguish between different origins? AFAIU, all the changes applied on any particular node use the same origin. > I can imagine if a cycle happens should probably log some one-time > WARNING (just to bring it to the user's attention in case it was > caused by some accidental misconfiguration) but apart from that why > would this need to be an option at all - i.e. is there a use-case > where a user would NOT want to prevent a recursive error? > I think there will be plenty of such setups where there won't be a need for any such option like where users won't need bi-directional replication for the same table. -- 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