public inbox for [email protected]  
help / color / mirror / Atom feed
From: Sami Imseih <[email protected]>
To: Heikki Linnakangas <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Clean up NamedLWLockTranche stuff
Date: Thu, 26 Mar 2026 23:49:11 -0500
Message-ID: <CAA5RZ0sLENRM+BicUjQFs_rP38oPx3gm0SsGrD0-jMhhM+HZ_w@mail.gmail.com> (raw)
In-Reply-To: <CAA5RZ0s+-_d6RBSfmLvekGLTCi2EZ7hiHp3RhMVDEexGXq=7Vg@mail.gmail.com>
References: <[email protected]>
	<acVEqGemyK-Yjswa@nathan>
	<[email protected]>
	<CAA5RZ0ueB84OUews-mS0+ojeWaDtcoV1qY4CNZD8PrdGcaXW-g@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAA5RZ0s+-_d6RBSfmLvekGLTCi2EZ7hiHp3RhMVDEexGXq=7Vg@mail.gmail.com>

> +/* backend-local copy of NamedLWLockTranches->num_user_defined */
> +static int  LocalNumUserDefinedTranches;

> The comment here should reference "LWLockTranches->num_user_defined "
> instead.

> Also, there are a few places in lwlock.c where "named tranches" is mentioned.
> Maybe we should just say "user-defined tranches" instead?

Like the attached.

--
Sami


Attachments:

  [application/octet-stream] v1-0001-fix-some-comments-for-lwlock-tranches.patch (2.0K, 2-v1-0001-fix-some-comments-for-lwlock-tranches.patch)
  download | inline diff:
From 3f8053adde0da2c99fd1e02f464a7247c73f0887 Mon Sep 17 00:00:00 2001
From: Sami Imseih <[email protected]>
Date: Fri, 27 Mar 2026 04:46:55 +0000
Subject: [PATCH v1 1/1] fix some comments for lwlock tranches

---
 src/backend/storage/lmgr/lwlock.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index 241f1f08430..2ee385698e5 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -200,7 +200,7 @@ typedef struct LWLockTrancheShmemData
 
 static LWLockTrancheShmemData *LWLockTranches;
 
-/* backend-local copy of NamedLWLockTranches->num_user_defined */
+/* backend-local copy of LWLockTranches->num_user_defined */
 static int	LocalNumUserDefinedTranches;
 
 /*
@@ -460,7 +460,7 @@ LWLockShmemInit(void)
 }
 
 /*
- * Initialize LWLocks that are fixed and those belonging to named tranches.
+ * Initialize LWLocks that are fixed and those belonging to user-defined tranches.
  */
 static void
 InitializeLWLocks(int numLocks)
@@ -487,7 +487,7 @@ InitializeLWLocks(int numLocks)
 		LWLockInitialize(&MainLWLockArray[pos++].lock, LWTRANCHE_PREDICATE_LOCK_MANAGER);
 
 	/*
-	 * Copy the info about any named tranches into shared memory (so that
+	 * Copy the info about any user-defined tranches into shared memory (so that
 	 * other processes can see it), and initialize the requested LWLocks.
 	 */
 	Assert(pos == NUM_FIXED_LWLOCKS);
@@ -536,8 +536,9 @@ GetNamedLWLockTranche(const char *tranche_name)
 
 	/*
 	 * Obtain the position of base address of LWLock belonging to requested
-	 * tranche_name in MainLWLockArray.  LWLocks for named tranches are placed
-	 * in MainLWLockArray after fixed locks.
+	 * tranche_name in MainLWLockArray.  LWLocks for user-defined tranches
+	 * requested with RequestNamedLWLockTranche() are placed in
+	 * MainLWLockArray after fixed locks.
 	 */
 	for (int i = 0; i < LocalNumUserDefinedTranches; i++)
 	{
-- 
2.47.3



view thread (14+ messages)  latest in thread

reply

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Clean up NamedLWLockTranche stuff
  In-Reply-To: <CAA5RZ0sLENRM+BicUjQFs_rP38oPx3gm0SsGrD0-jMhhM+HZ_w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox