Re: Logical Replication of sequences

From: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(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-05-20 09:05:40
Message-ID: CABdArM5earU8j1cBenw=h9vVMiPdyRPuh2djWsOyA+NFOy2sxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, May 20, 2025 at 8:35 AM Nisha Moond <nisha(dot)moond412(at)gmail(dot)com> wrote:
>
> >
> > Thanks for the comments, these are handled in the attached v20250516
> > version patch.
> >
>
> Thanks for the patches. Here are my review comments -
>
> Patch-0004: src/backend/replication/logical/sequencesync.c
>

Hi,

Currently, the behavior of the internal query used to fetch sequence
info from the pub is inconsistent and potentially misleading.

case1: If a single non-existent sequence is passed (e.g., VALUES
('public','n10')), the query throws an ERROR, so we get error on sub -
ERROR: could not receive list of sequence information from the
publisher: ERROR: sequence "public.n10" does not exist

case2: If multiple non-existent sequences are passed (e.g., VALUES
('public','n8'),('public','n9')), it silently returns zero rows,
resulting only in a LOG message instead of an error.
LOG: Logical replication sequence synchronization for subscription
"subs" - total unsynchronized: 2; batch #1 = 2 attempted, 0 succeeded,
0 mismatched

IMO, This inconsistency can be confusing for users. I think we should
make the behavior uniform. Either -
(a) Raise an error if any/all of the requested sequences are missing
on the publisher, or
(b) Instead of raising an error, emit a LOG(as is done in case2) and
maybe include the count of missing sequences too.

I'm fine with either option.

--
Thanks,
Nisha

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-05-20 09:13:27 Re: Make wal_receiver_timeout configurable per subscription
Previous Message Dmitry Dolgov 2025-05-20 09:03:52 Re: queryId constant squashing does not support prepared statements