public inbox for [email protected]help / color / mirror / Atom feed
Rename LWLockNewTrancheId() parameter from "name" to "tranche_name" 3+ messages / 2 participants [nested] [flat]
* Rename LWLockNewTrancheId() parameter from "name" to "tranche_name" @ 2026-03-26 18:34 Sami Imseih <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Sami Imseih @ 2026-03-26 18:34 UTC (permalink / raw) To: pgsql-hackers; +Cc: Nathan Bossart <[email protected]> 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 ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Rename LWLockNewTrancheId() parameter from "name" to "tranche_name" @ 2026-03-26 19:30 Nathan Bossart <[email protected]> parent: Sami Imseih <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Nathan Bossart @ 2026-03-26 19:30 UTC (permalink / raw) To: Sami Imseih <[email protected]>; +Cc: pgsql-hackers On Thu, Mar 26, 2026 at 01:34:38PM -0500, Sami Imseih wrote: > 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. I don't mind changing it, but I don't find "tranche_name" to be substantially better than "name" in this case. Maybe it's a little clearer, but there's not much room for confusion here. -- nathan ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Rename LWLockNewTrancheId() parameter from "name" to "tranche_name" @ 2026-03-26 19:33 Sami Imseih <[email protected]> parent: Nathan Bossart <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Sami Imseih @ 2026-03-26 19:33 UTC (permalink / raw) To: Nathan Bossart <[email protected]>; +Cc: pgsql-hackers > > 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. > > I don't mind changing it, but I don't find "tranche_name" to be > substantially better than "name" in this case. It's just a matter of consistency and it's more descriptive to the caller, IMO. -- Sami Imseih Amazon Web Services (AWS) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-03-26 19:33 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-03-26 18:34 Rename LWLockNewTrancheId() parameter from "name" to "tranche_name" Sami Imseih <[email protected]> 2026-03-26 19:30 ` Nathan Bossart <[email protected]> 2026-03-26 19:33 ` Sami Imseih <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox