pgsql: Make LWLockCounter a global variable. - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Make LWLockCounter a global variable.
Date
Msg-id E1us2fu-002Frr-10@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix .gitignore for src/interfaces/libpq-oauth.
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: pg_dump: Fix compression API errorhandling