On Wed, Mar 6, 2024 at 12:47 PM Amit Kapila <amit.kapil...@gmail.com> wrote: > > On Wed, Mar 6, 2024 at 7:36 AM Masahiko Sawada <sawada.m...@gmail.com> wrote: > > > > On Tue, Mar 5, 2024 at 4:21 PM Zhijie Hou (Fujitsu) > > <houzj.f...@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