Re: Improve LWLock tranche name visibility across backends
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Sami Imseih <samimseih@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Rahila Syed <rahilasyed90@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-08-29T07:05:14Z
Lists: pgsql-hackers
Hi, On Thu, Aug 28, 2025 at 05:53:23PM -0500, Sami Imseih wrote: > Just a few things that were discussed earlier, that I incorporated now. > > 1/ We should be checking that tranche_name is NOT NULL when > LWLockNewTrancheId or RequestNamedLWLockTranche is called. Right, if not strlen() does segfault. In addition to checking for NULL, should we also check for empty string? Currently, the patch does accept strlen(tranche_name) == 0. > Also check for the length of the tranche name inside > RequestNamedLWLockTranche, instead of relying on an Assert to check > the length. I think that is much safer. Same remark as above but in RequestNamedLWLockTranche(). Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
-
test_dsa: Avoid leaking LWLock tranches.
- c5c74282f2ea 19 (unreleased) landed
-
Teach DSM registry to ERROR if attaching to an uninitialized entry.
- b26d76f64327 18.2 landed
- ac2800ddc185 17.8 landed
- 1165a933aab1 19 (unreleased) landed
-
Add a test harness for the LWLock tranche code.
- 16607718c010 19 (unreleased) landed
-
Revert recent change to RequestNamedLWLockTranche().
- d814d7fc3d52 19 (unreleased) landed
-
Move dynamically-allocated LWLock tranche names to shared memory.
- 38b602b0289f 19 (unreleased) landed
-
Prepare DSM registry for upcoming changes to LWLock tranche names.
- 5487058b56e0 19 (unreleased) landed
-
Add GetNamedDSA() and GetNamedDSHash().
- fe07100e82b0 19 (unreleased) cited