Re: Improve LWLock tranche name visibility across backends

Sami Imseih <samimseih@gmail.com>

From: Sami Imseih <samimseih@gmail.com>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-01T18:45:22Z
Lists: pgsql-hackers
> > Also, I suspect that there might be some concerns about the API changes.
> > While it should be a very easy fix, that seems likely to break a lot of
> > extensions.
> > I don't know if it's possible to make this stuff backward
> > compatible, and I also don't know if we really want to, as that'll both
> > introduce more complexity and keep folks using the old API.
>
> Yeah, I'm not sure that would be worth the extra complexity and using the
> old API
> would "keep" the issue we're trying to solve here.
>
> I don't think we should be worried that much by the number of extensions
> impacted
> but more about the change complexity and it looks pretty simple.
>
> So, I don't think we should worry that much in that regard.


I agree. I don’t think the API changes are a big
deal, especially when they reduce the number of
of steps.

-- 
Sami

Commits

  1. test_dsa: Avoid leaking LWLock tranches.

  2. Teach DSM registry to ERROR if attaching to an uninitialized entry.

  3. Add a test harness for the LWLock tranche code.

  4. Revert recent change to RequestNamedLWLockTranche().

  5. Move dynamically-allocated LWLock tranche names to shared memory.

  6. Prepare DSM registry for upcoming changes to LWLock tranche names.

  7. Add GetNamedDSA() and GetNamedDSHash().