Re: Clean up NamedLWLockTranche stuff - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Clean up NamedLWLockTranche stuff
Date
Msg-id 1e1dd445-730e-40c9-b0f7-4d153bb013fb@iki.fi
Whole thread Raw
In response to Re: Clean up NamedLWLockTranche stuff  (Sami Imseih <samimseih@gmail.com>)
Responses Re: Clean up NamedLWLockTranche stuff
Re: Clean up NamedLWLockTranche stuff
List 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




pgsql-hackers by date:

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