From: | vignesh C <vignesh21(at)gmail(dot)com> |
---|---|
To: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
Cc: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Euler Taveira <euler(at)eulerto(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, "Jonathan S(dot) Katz" <jkatz(at)postgresql(dot)org> |
Subject: | Re: Logical Replication of sequences |
Date: | 2025-09-01 05:39:31 |
Message-ID: | CALDaNm2t+b7+qtz5Xz-DB7re+d3SXTy03qQkrPE4KKALcNfU=Q@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 26 Aug 2025 at 11:21, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>
> On Thu, Aug 21, 2025 at 10:08 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
>
> > I have also addressed all the comments from [1] in the attached
> > v20250823 version patch.
> > [1] - https://www.postgresql.org/message-id/CAA4eK1%2BoVQW8oP%3DLo1X8qac6dzg-fgGQ6R_F_psfokUEqe%2Ba6w%40mail.gmail.com
> >
>
> Thank You for the patches. I see a race condition between alter-seq and refresh.
>
> Say we have triggered REFRESH on sub, and when seq-sync worker is in
> copy_sequences() where it has retrieved the local sequence using
> seqname while it has not locked the sequence-relation yet, if
> meanwhile we alter sequence and change its name, seq-sync worker ends
> up syncing that renamed sequence values with old-fetched sequence.
> Steps:
>
> 1) create a sequence seq0 on pub and sub
> 2) do REFRESH PUBLICATION SEQ on sub
> 3) In seq-sync worker, during copy_sequences() hold debugger at:
> seqinfo->remote_seq_fetched = true;
> 4) rename sequence on sub : ALTER SEQUENCE seq0 RENAME TO seq1;
> 5) release debugger in seq-sync worker. It will end up syncing seq1
> using seq0 fetched from pub.
Thanks for reporting this, this is handled in the attached version of patch.
Regards,
Vignesh
Attachment | Content-Type | Size |
---|---|---|
v20250901-0001-Enhance-pg_get_sequence_data-function.patch | application/octet-stream | 7.4 KB |
v20250901-0003-Reorganize-tablesync-Code-and-Introduce-sy.patch | application/octet-stream | 24.6 KB |
v20250901-0004-Update-ALTER-SUBSCRIPTION-REFRESH-to-ALTER.patch | application/octet-stream | 8.9 KB |
v20250901-0005-Introduce-REFRESH-PUBLICATION-SEQUENCES-fo.patch | application/octet-stream | 40.0 KB |
v20250901-0002-Introduce-ALL-SEQUENCES-support-for-Postgr.patch | application/octet-stream | 110.7 KB |
v20250901-0006-New-worker-for-sequence-synchronization-du.patch | application/octet-stream | 84.8 KB |
v20250901-0007-Documentation-for-sequence-synchronization.patch | application/octet-stream | 33.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-09-01 06:19:46 | Re: pg_upgrade: transfer pg_largeobject_metadata's files when possible |
Previous Message | Michael Paquier | 2025-09-01 05:35:06 | Re: Orphan page in _bt_split |