Subject: Re: Missing LWLock protection in pgstat_reset_replslot()

From: shveta malik <[email-masked]>
Date: Tue, 5 Mar 2024 14:19:19 +0530

On Tue, Mar 5, 2024 at 1:25 PM Heikki Linnakangas <[email-masked]> wrote:

> SearchNamedReplicationSlot() will also acquire the lock in LW_SHARED
> mode, when you pass need_lock=true. So that at least should be changed
> to false.
>

Also don't we need to release the lock when we return here:

/*
* Nothing to do for physical slots as we collect stats only for logical
* slots.
*/
if (SlotIsPhysical(slot))
return;

thanks
Shveta

---

From: Bertrand Drouvot <[email-masked]>
Date: Tue, 5 Mar 2024 13:22:23 +0000

Hi,

> if (SlotIsPhysical(slot))

D'oh! Thanks! Fixed in v2 shared up-thread.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com