Re: Spurious pgstat_drop_replslot() call

Alexander Law <exclusion@gmail.com>

From: Alexander Lakhin <exclusion@gmail.com>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2024-03-12T09:00:00Z
Lists: pgsql-hackers
Hello Bertrand and Michael,

12.03.2024 09:17, Bertrand Drouvot wrote:
>
>> May I
>> suggest the attached additions with LWLockHeldByMeInMode to make sure
>> that the stats are dropped and created while we hold
>> ReplicationSlotAllocationLock?
> Yeah, makes fully sense and looks good to me.

Sorry for a bit off-topic, but I've remembered an anomaly with a similar
assert:
https://www.postgresql.org/message-id/17947-b9554521ad963c9c%40postgresql.org

Maybe you would find it worth considering while working in this area...
(I've just run that reproducer on b36fbd9f8 and confirmed that the
assertion failure is still here.)

Best regards,
Alexander



Commits

  1. Add some asserts based on LWLockHeldByMe() for replication slot statistics

  2. Keep replication slot statistics on invalidation