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-04T16:32:19Z
Lists: pgsql-hackers
> > > I think we could add a local backend copy that stays up to date with the > > > DSA. One idea would be to use an atomic counter to track the number of > > > entries in the DSA and compare it with a local backend counter whenever the > > > tranche name lookup occurs. If the atomic counter is higher (since we > > > don't have deletions), > > > we can update the local copy. Updating the local table should be a > > > rare occurrence, but it would > > > require an additional atomic fetch every time the name lookup occurs, in all the > > > above code paths. > > > > > > Perhaps there's a better approach? > > > > I was thinking to switch to the DSA (and update local copy) when a name is > > not found in the local copy. That way there is no need to maintain a counter and > > the DSA overhead should be rare enough. > > > > Regards, > > That should work as well. good idea. With a local hash table, I don't think it's necessary to introduce new code for managing a DSA based list of tranche names as is done in v3. We can go back to storing the shared trance names in dshash. What do you think? -- Sami
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