Re: Logical Replication of sequences

Поиск
Список
Период
Сортировка
От shveta malik
Тема Re: Logical Replication of sequences
Дата
Msg-id CAJpy0uC-Jx2L6tOTnDQ_Zwz99X3HQDik6tG=+1a71SxZFiy12w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Logical Replication of sequences  (vignesh C <vignesh21@gmail.com>)
Список pgsql-hackers
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
Shveta



В списке pgsql-hackers по дате отправления: