Re: Synchronizing slots from primary to standby

Поиск
Список
Период
Сортировка
От Masahiko Sawada
Тема Re: Synchronizing slots from primary to standby
Дата
Msg-id CAD21AoDMNABFYbC6tRc3LJn01Z0qPHGgA-AAvvQ6wj8rvO3MyQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Synchronizing slots from primary to standby  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Wed, Mar 6, 2024 at 12:47 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Wed, Mar 6, 2024 at 7:36 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> >
> > On Tue, Mar 5, 2024 at 4:21 PM Zhijie Hou (Fujitsu)
> > <houzj.fnst@fujitsu.com> wrote:
> >
> > I have one question about PhysicalWakeupLogicalWalSnd():
> >
> > +/*
> > + * Wake up the logical walsender processes with logical failover slots if the
> > + * currently acquired physical slot is specified in standby_slot_names GUC.
> > + */
> > +void
> > +PhysicalWakeupLogicalWalSnd(void)
> > +{
> > +        List      *standby_slots;
> > +
> > +        Assert(MyReplicationSlot && SlotIsPhysical(MyReplicationSlot));
> > +
> > +        standby_slots = GetStandbySlotList();
> > +
> > +        foreach_ptr(char, name, standby_slots)
> > +        {
> > +                if (strcmp(name, NameStr(MyReplicationSlot->data.name)) == 0)
> > +                {
> > +
> > ConditionVariableBroadcast(&WalSndCtl->wal_confirm_rcv_cv);
> > +                        return;
> > +                }
> > +        }
> > +}
> >
> > IIUC walsender calls this function every time after updating the
> > slot's restart_lsn, which could be very frequently. I'm concerned that
> > it could be expensive to do a linear search on the standby_slot_names
> > list every time. Is it possible to cache the information in walsender
> > local somehow?
> >
>
> We can cache this information for WalSender but not for the case where
> users use pg_physical_replication_slot_advance(). We don't expect this
> list to be long enough to matter, so we can leave this optimization
> for the future especially if we encounter any such case unless you
> think otherwise.

Okay, agreed.

Regards,

--
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com



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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Switching XLog source from archive to streaming when primary available
Следующее
От: shveta malik
Дата:
Сообщение: Re: Missing LWLock protection in pgstat_reset_replslot()