From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make LWLockCounter a global variable.
Date: Fri, 29 Aug 2025 17:14:06 +0000
Message-ID: <E1us2fu-002Frr-10@gemulon.postgresql.org> (raw)
Make LWLockCounter a global variable.
Using the LWLockCounter requires first calculating its address in
shared memory like this:
LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int));
Commit 82e861fbe1 started this trend in order to fix EXEC_BACKEND
builds, but it could also be fixed by adding it to the
BackendParameters struct. The current approach is somewhat
difficult to follow, so this commit switches to the latter. While
at it, swap around the code in LWLockShmemSize() to match the order
of assignments in CreateLWLocks() for added readability.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aLDLnan9gNCS9fHx%40nathan
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/67fcf48c3bb3cc3cf51788332701ffb694fb108b
Modified Files
--------------
src/backend/postmaster/launch_backend.c | 3 +++
src/backend/storage/lmgr/lwlock.c | 24 ++++++++----------------
src/include/storage/lwlock.h | 1 +
3 files changed, 12 insertions(+), 16 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Make LWLockCounter a global variable.
In-Reply-To: <E1us2fu-002Frr-10@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox