Re: Handle infinite recursion in logical replication setup

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: Handle infinite recursion in logical replication setup
Date: 2022-04-07 06:13:56
Message-ID: CAHut+PvY2P=UL-X6maMA5QxFKdcdciRRCKDH3j=_hO8u2OyRYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 7, 2022 at 4:03 PM kuroda(dot)hayato(at)fujitsu(dot)com
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Peter,
>
> > FYI, here is a test script that is using the current patch (v6) to
> > demonstrate a way to share table data between different numbers of
> > nodes (up to 5 of them here).
>
> Thanks for sharing your script! It's very helpful for us.
>
> While reading your script, however, I had a question about it.
> Line 121-122, you defined subscriptions for 2-nodes cluster:
>
> psql -p $port_N1 -c "create subscription sub12 connection 'port=$port_N2' publication pub2 with ($copy_force);"
> psql -p $port_N2 -c "create subscription sub21 connection 'port=$port_N1' publication pub1 with ($copy_force);"
>
> But I was not sure it works well.
> N2 already have shared data from N1 when subscription sub21 is created.
> Did you assume that the initial copying is not so quick and
> data synchronization will be not done when creating sub21?

Oops. Good catch.

Although the 2-way test was working OK for me, I think that it worked
only because of lucky timing. e.g. When I put a delay between those 2
subscriptions then the 2nd one would cause the PK violation that
probably you were anticipating would happen.

I have modified the 2-way example to use the same truncate pattern as others.

PSA the fixed test.sh script and accompanying files.

------
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
test_output.txt text/plain 10.8 KB
N2.log application/octet-stream 8.6 KB
N3.log application/octet-stream 9.5 KB
test.sh text/x-sh 9.8 KB
N5.log application/octet-stream 11.2 KB
N4.log application/octet-stream 10.4 KB
N1.log application/octet-stream 12.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2022-04-07 06:15:27 Re: Extensible Rmgr for Table AMs
Previous Message kuroda.hayato@fujitsu.com 2022-04-07 06:03:34 RE: Handle infinite recursion in logical replication setup