Re: Clean up NamedLWLockTranche stuff

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Sami Imseih <samimseih@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Robert Haas <robertmhaas@gmail.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2026-03-26T22:03:15Z
Lists: pgsql-hackers
On 26/03/2026 18:57, Heikki Linnakangas wrote:
> Thanks!
> 
> On 26/03/2026 18:34, Sami Imseih wrote:
>>> 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:

I committed these now, but I'm all ears if you still have comments on 
the rest of the patches.

- Heikki




Commits

  1. Fix outdated comment on MainLWLockArray

  2. Fix RequestNamedLWLockTranche in single-user mode

  3. Minor comment fixes to yesterday's LWLock tranche refactoring

  4. Move ShmemIndexLock into ShmemAllocator

  5. Use ShmemInitStruct to allocate lwlock.c's shared memory

  6. Use a separate spinlock to protect LWLockTranches

  7. Refactor how user-defined LWLock tranches are stored in shmem

  8. Rename MAX_NAMED_TRANCHES to MAX_USER_DEFINED_TRANCHES

  9. Fix re-initialization of LWLock-related shared memory.