public inbox for [email protected]
help / color / mirror / Atom feedFrom: Sami Imseih <[email protected]>
To: pgsql-hackers <[email protected]>
Cc: Nathan Bossart <[email protected]>
Subject: Rename LWLockNewTrancheId() parameter from "name" to "tranche_name"
Date: Thu, 26 Mar 2026 13:34:38 -0500
Message-ID: <CAA5RZ0tpJ8GBrWshkUJ29Fu3juqgdbr=kfK3O9FMLrEy1zPOkg@mail.gmail.com> (raw)
Hi,
While looking at something nearby, I noticed a naming inconsistency
for the parameter
name in LWLockNewTrancheId(). It should be tranche_name, similar to
RequestNamedLWLockTranche(), and in other places it's referenced in
the docs/comments.
CC'ng Nathan who committed 38b602b0289fe1d where this was introduced.
--
Sami Imseih
Amazon Web Services (AWS)
Attachments:
[application/octet-stream] v1-0001-Rename-LWLockNewTrancheId-parameter-from-name-to-.patch (2.9K, 2-v1-0001-Rename-LWLockNewTrancheId-parameter-from-name-to-.patch)
download | inline diff:
From 323d85610dcbccf00028b9654d4cba90f3ae69a3 Mon Sep 17 00:00:00 2001
From: Sami Imseih <[email protected]>
Date: Thu, 26 Mar 2026 18:27:50 +0000
Subject: [PATCH v1 1/1] Rename LWLockNewTrancheId() parameter from "name" to
"tranche_name"
This makes the parameter naming consistent with GetNamedLWLockTranche(),
which already uses "tranche_name". Update the function signature in the
header, the implementation in lwlock.c, and the documentation in
xfunc.sgml to match.
---
doc/src/sgml/xfunc.sgml | 2 +-
src/backend/storage/lmgr/lwlock.c | 8 ++++----
src/include/storage/lwlock.h | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index 70e815b8a2c..6d464d4d7cf 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -3765,7 +3765,7 @@ LWLockPadded *GetNamedLWLockTranche(const char *tranche_name)
<literal>shmem_request_hook</literal>. To do so, first allocate a
<literal>tranche_id</literal> by calling:
<programlisting>
-int LWLockNewTrancheId(const char *name)
+int LWLockNewTrancheId(const char *tranche_name)
</programlisting>
Next, initialize each LWLock, passing the new
<literal>tranche_id</literal> as an argument:
diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c
index 49382de88fc..d934ff40f71 100644
--- a/src/backend/storage/lmgr/lwlock.c
+++ b/src/backend/storage/lmgr/lwlock.c
@@ -594,16 +594,16 @@ GetNamedLWLockTranche(const char *tranche_name)
* Allocate a new tranche ID with the provided name.
*/
int
-LWLockNewTrancheId(const char *name)
+LWLockNewTrancheId(const char *tranche_name)
{
int result;
- if (!name)
+ if (!tranche_name)
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("tranche name cannot be NULL")));
- if (strlen(name) >= NAMEDATALEN)
+ if (strlen(tranche_name) >= NAMEDATALEN)
ereport(ERROR,
(errcode(ERRCODE_NAME_TOO_LONG),
errmsg("tranche name too long"),
@@ -627,7 +627,7 @@ LWLockNewTrancheId(const char *name)
result = (*LWLockCounter)++;
LocalLWLockCounter = *LWLockCounter;
- strlcpy(LWLockTrancheNames[result - LWTRANCHE_FIRST_USER_DEFINED], name, NAMEDATALEN);
+ strlcpy(LWLockTrancheNames[result - LWTRANCHE_FIRST_USER_DEFINED], tranche_name, NAMEDATALEN);
SpinLockRelease(ShmemLock);
diff --git a/src/include/storage/lwlock.h b/src/include/storage/lwlock.h
index 9a0290391d0..dd5142c10d0 100644
--- a/src/include/storage/lwlock.h
+++ b/src/include/storage/lwlock.h
@@ -155,7 +155,7 @@ extern LWLockPadded *GetNamedLWLockTranche(const char *tranche_name);
* counter. Second, LWLockInitialize should be called just once per lwlock,
* passing the tranche ID as an argument.
*/
-extern int LWLockNewTrancheId(const char *name);
+extern int LWLockNewTrancheId(const char *tranche_name);
extern void LWLockInitialize(LWLock *lock, int tranche_id);
/*
--
2.47.3
view thread (3+ 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]
Subject: Re: Rename LWLockNewTrancheId() parameter from "name" to "tranche_name"
In-Reply-To: <CAA5RZ0tpJ8GBrWshkUJ29Fu3juqgdbr=kfK3O9FMLrEy1zPOkg@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