pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Rahila Syed <rahilasyed90@gmail.com>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Improve LWLock tranche name visibility across backends
Date: Thu, 4 Sep 2025 15:37:51 -0500
Message-ID: <aLn4n-5UFzKHFdR5@nathan> (raw)
In-Reply-To: <CAA5RZ0t6s2Z38oRq883Ocq7J4xjn1FJF17Q4YR6++vrw5KYCtQ@mail.gmail.com>
References: <CAA5RZ0s4ip08Lsk=aYuXGCkBr78jhH=gOau939mhAp-rGuNC3Q@mail.gmail.com>
	<aLCEo0ZMV3vIGRWk@nathan>
	<CAA5RZ0vw-r1qjHw5hUNTzAyCiK3KQ-r+G5ECfWSn+qjdu-fpnw@mail.gmail.com>
	<aLHO-jh-spXWG1pt@nathan>
	<aLJnOnTFSweb2pud@nathan>
	<CAH2L28sz2NcLCS2v1MNkBNUiTiO=-CegFGdAvO24nE+hbjzgjQ@mail.gmail.com>
	<aLcPbyWLawp5_rdt@nathan>
	<aLiQeizOQKbKF-ae@nathan>
	<aLmzwC2dRbqk14y6@nathan>
	<CAA5RZ0t6s2Z38oRq883Ocq7J4xjn1FJF17Q4YR6++vrw5KYCtQ@mail.gmail.com>

On Thu, Sep 04, 2025 at 12:30:27PM -0500, Sami Imseih wrote:
> I liked removing the repalloc calls inside this routine and did not think
> it was worth optimizing. I am OK with reverting it back. Although v1
> is incorrect since it's still initializing
> NamedLWLockTrancheRequestArray to MAX_NAMED_TRANCHES

Committed with that fix.

>> Furthermore, the
>> MAX_NAMED_TRANCHES check isn't actually needed because InitializeLWLocks()
>> will do the same check via its calls to LWLockNewTrancheId() for all the
>> named tranche requests.
> 
> I thought about that one and decided to add the error message there, since
> requesting a tranche happens way before LWLockNewTrancheId is called
> during CreateLWLocks, so it was more about erroring out slightly earlier.
> But it may be ok to also just remove it.

We needed it before because the array could only ever hold
MAX_NAMED_TRANCHES requests.

-- 
nathan





view thread (107+ messages)  latest in thread

Message-ID: <aLn4n-5UFzKHFdR5@nathan>
Permalink:  ../aLn4n-5UFzKHFdR5@nathan/
Also on:    postgresql.org/message-id/aLn4n-5UFzKHFdR5@nathan

 · 

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-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, samimseih@gmail.com, rahilasyed90@gmail.com, bertranddrouvot.pg@gmail.com, tgl@sss.pgh.pa.us, andres@anarazel.de
  Subject: Re: Improve LWLock tranche name visibility across backends
  In-Reply-To: <aLn4n-5UFzKHFdR5@nathan>

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

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