On Tue, 26 Aug 2025 at 11:21, shveta malik <shveta.malik@gmail.com> wrote:
>
> On Thu, Aug 21, 2025 at 10:08 PM vignesh C <vignesh21@gmail.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