Re: Clean up NamedLWLockTranche stuff

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clean up NamedLWLockTranche stuff
Date: 2026-03-27 09:45:56
Message-ID: 1e1dd445-730e-40c9-b0f7-4d153bb013fb@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 27/03/2026 06:49, Sami Imseih wrote:
>> +/* backend-local copy of NamedLWLockTranches->num_user_defined */
>> +static int LocalNumUserDefinedTranches;
>
>> The comment here should reference "LWLockTranches->num_user_defined "
>> instead.
>
>> Also, there are a few places in lwlock.c where "named tranches" is mentioned.
>> Maybe we should just say "user-defined tranches" instead?
>
> Like the attached.

> @@ -460,7 +460,7 @@ LWLockShmemInit(void)
> }
>
> /*
> - * Initialize LWLocks that are fixed and those belonging to named tranches.
> + * Initialize LWLocks that are fixed and those belonging to user-defined tranches.
> */
> static void
> InitializeLWLocks(int numLocks)

Only tranches requested with RequestNamedLWLockTranche() have locks in
the main array, so I reworded this some more to:

/*
* Initialize LWLocks for built-in tranches and those requested with
* RequestNamedLWLockTranche().
*/

Committed with that little change, thanks!

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-03-27 09:49:00 Re: Use SIGTERM instead of SIGUSR1 for slotsync worker to exit during promotion?
Previous Message Alexandre Felipe 2026-03-27 09:29:03 Re: SLOPE - Planner optimizations on monotonic expressions.