Re: Synchronizing slots from primary to standby

Поиск
Список
Период
Сортировка
От shveta malik
Тема Re: Synchronizing slots from primary to standby
Дата
Msg-id CAJpy0uD+ODUF+D0GX38F_UQYTqA8wvTEUPOCBa-9guLLRMhFWQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Synchronizing slots from primary to standby  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: Synchronizing slots from primary to standby  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Список pgsql-hackers
On Fri, Jan 19, 2024 at 11:23 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> > > 5 === (coming from v62-0002)
> > > +       Assert(tuplestore_tuple_count(res->tuplestore) == 1);
> > >
> > > Is it even possible for the related query to not return only one row? (I think the
> > > "count" ensures it).
> >
> > I think you are right. This assertion was added sometime back on the
> > basis of feedback on hackers. Let me review that again. I can consider
> > this comment in the next version.
> >
>
> OTOH, can't we keep the assert as it is but remove "= 1" from
> "count(*) = 1" in the query. There shouldn't be more than one slot
> with same name on the primary. Or, am I missing something?

There will be 1 record max and 0 record if the primary_slot_name is
invalid. Keeping 'count(*)=1' gives the benefit that it will straight
away give us true/false indicating if we are good or not wrt
primary_slot_name. I feel Assert can be removed and we can simply
have:

        if (!tuplestore_gettupleslot(res->tuplestore, true, false, tupslot))
                elog(ERROR, "failed to fetch primary_slot_name tuple");

thanks
Shveta



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

Предыдущее
От: Alexander Lakhin
Дата:
Сообщение: Re: Test slots invalidations in 035_standby_logical_decoding.pl only if dead rows are removed
Следующее
От: Andy Fan
Дата:
Сообщение: Re: the s_lock_stuck on perform_spin_delay