agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check that the tranche name is unique in RequestNamedLWLockTranc
Date: Sun, 05 Apr 2026 18:11:33 +0000
Message-ID: <E1w9Rwa-00376E-2T@gemulon.postgresql.org> (raw)

Check that the tranche name is unique in RequestNamedLWLockTranche

You could request two tranches with same name, but things would get
confusing when you called GetNamedLWLockTranche() to get the LWLocks
allocated for them; it would always return the first tranche with the
name. That doesn't make sense, so forbid duplicates.

We still allow duplicates with LWLockNewTrancheId(). That works better
as you don't use the name to look up the tranche ID later. It's still
confusing in wait events, for example, but it's not dangerous in the
same way.

Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://www.postgresql.org/message-id/463a28db-0c0b-4af6-bac6-3891828bbbfe@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f10b6be2581f879f24a4830443bab356ec6d71c5

Modified Files
--------------
src/backend/storage/lmgr/lwlock.c | 7 +++++++
1 file changed, 7 insertions(+)



Message-ID: <E1w9Rwa-00376E-2T@gemulon.postgresql.org>
Permalink:  ../E1w9Rwa-00376E-2T@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w9Rwa-00376E-2T@gemulon.postgresql.org

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: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Check that the tranche name is unique in RequestNamedLWLockTranc
  In-Reply-To: <E1w9Rwa-00376E-2T@gemulon.postgresql.org>

* 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