Re: Missing LWLock protection in pgstat_reset_replslot()

shveta malik <shveta.malik@gmail.com>

From: shveta malik <shveta.malik@gmail.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, pgsql-hackers@lists.postgresql.org, shveta malik <shveta.malik@gmail.com>
Date: 2024-03-05T08:49:19Z
Lists: pgsql-hackers
On Tue, Mar 5, 2024 at 1:25 PM Heikki Linnakangas <hlinnaka@iki.fi> 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



Commits

  1. Fix invalidation of local pgstats references for entry reinitialization

  2. Improve consistency of replication slot statistics