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 11:34:32 -0500
Message-ID: <CAA5RZ0ueB84OUews-mS0+ojeWaDtcoV1qY4CNZD8PrdGcaXW-g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<acVEqGemyK-Yjswa@nathan>
	<[email protected]>

Hi,

Thanks for the patches!

> I propose the attached refactorings to make this less confusing. See
> commit messages for details.

I only took a look at 0001 so far, and I do agree with this statement
in the commit message:

"The "user defined" term was already used in LWTRANCHE_FIRST_USER_DEFINED,
so let's standardize on that to mean tranches allocated with either
RequestNamedLWLockTranche() or LWLockNewTrancheId()."

I do wonder if 0001 is going far enough though.

Instead of just standardizing that "user defined" could mean tranches allocated
with RequestNamedLWLockTranche() or LWLockNewTrancheId(), how about we also
rename these APIs to reflect that as well? This way we remove all concept of
"named tranche" which is what it sounds like to me you are proposing.

rename RequestNamedLWLockTranche() to RequestUserDefinedLWLockTranche()
and LWLockNewTrancheId() to RegisterUserDefinedLWLockTranche()

RequestNamedLWLockTranche() requests the lwlock at shmem_request time,
which is later registered via LWLockNewTrancheId() when lwlocks are
initialized by the postmaster.

Also, the name LWLockNewTrancheId() is selling what this function does
too short.
It does return a new tranche ID, but it also takes in a user-defined tranche
name and copies ("registers") that name into LWLockTrancheNames.

v19 is already changing the signature of LWLockNewTrancheId(), so maybe
improving the names of these APIs makes sense to do.

--
Sami Imseih
Amazon Web Services (AWS)





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: <CAA5RZ0ueB84OUews-mS0+ojeWaDtcoV1qY4CNZD8PrdGcaXW-g@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