Check that the tranche name is unique in RequestNamedLWLockTranche
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Author:
Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2026-04-05T18:05:20Z
Releases:
19 (unreleased)
Check that the tranche name is unique in RequestNamedLWLockTranche You could request two tranches with same name, but things would get confusing when you called GetNamedLWLockTranche() to get the LWLocks allocated for them; it would always return the first tranche with the name. That doesn't make sense, so forbid duplicates. We still allow duplicates with LWLockNewTrancheId(). That works better as you don't use the name to look up the tranche ID later. It's still confusing in wait events, for example, but it's not dangerous in the same way. Reviewed-by: Sami Imseih <samimseih@gmail.com> Discussion: https://www.postgresql.org/message-id/463a28db-0c0b-4af6-bac6-3891828bbbfe@iki.fi
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/storage/lmgr/lwlock.c | modified | +7 −0 |
Discussion
- Duplicate RequestNamedLWLocktranche() names and test_lwlock_tranches improvements 3 messages · 2026-04-05