pgsql: Add some asserts based on LWLockHeldByMe() for replication slot

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add some asserts based on LWLockHeldByMe() for replication slot
Date: 2024-03-12 22:49:01
Message-ID: E1rkAvc-003U6r-Qr@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Two assertions checking that ReplicationSlotAllocationLock is acquired
are added to pgstat_create_replslot() and pgstat_drop_replslot(),
corresponding to the routines in charge of the creation and the drop of
replication slot statistics. The code previously relied on this
assumption and documented it in comments, but did not enforce this
policy at runtime.

Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/Ze_p-hmD_yFeVYXg@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/77cf6a78de9fa48976d8c9152a48290beb06dc8b

Modified Files
--------------
src/backend/utils/activity/pgstat_replslot.c | 4 ++++
1 file changed, 4 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2024-03-13 02:01:29 pgsql: ci: Use a RAM disk and more CPUs on FreeBSD.
Previous Message Jeff Davis 2024-03-12 22:28:02 pgsql: Fix version check in 002_pg_upgrade.pl.