From: | Sami Imseih <samimseih(at)gmail(dot)com> |
---|---|
To: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
Cc: | Nathan Bossart <nathandbossart(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Improve LWLock tranche name visibility across backends |
Date: | 2025-08-29 13:30:06 |
Message-ID: | CAA5RZ0sS67OpxL89F5oLY2m3RNfhDubSp1V1Y44mEOyecZnpcw@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 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.
I am not inclined to prevent an empty string. It's currently allowed and rather
not change that.
> ```
> typedef struct NamedLWLockTranche
> {
> char trancheName[NAMEDATALEN];
> int num_lwlocks;
> } NamedLWLockTranche;
> ```
> if there is no interest to backpatch [0], maybe we should just make this
> change as part of this patch set. What do you think? I can make this change
> in v18.
Here is v18. It includes a third patch to fix the issue identified in
[0], which can
be applied to HEAD as part of this thread. If we want to backpatch the stable
branches, the version in [0] is suitable.
Note that I created a LWLockNewTrancheIdInternal which takes a tranch
name and number of lwlocks. The Internal version is used during startup when
requested lwlocks are appended to shared memory, and the existing
LWLockNewTrancheId calls the internal version with 0 lwlocks.
This keeps all the logic to appending a new tranche ( while holding
the spinlock )
in the same routine.
--
Sami
Attachment | Content-Type | Size |
---|---|---|
v18-0002-Move-dynamically-allocated-tranche-names-to-shar.patch | application/octet-stream | 23.5 KB |
v18-0003-Fix-EXEC_BACKEND-segfault-on-NamedLWLockTrancheR.patch | application/octet-stream | 7.4 KB |
v18-0001-dsm_registry-Use-one-LWLock-tranche-for-dshash-t.patch | application/octet-stream | 5.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Vik Fearing | 2025-08-29 13:47:52 | Re: Assert single row returning SQL-standard functions |
Previous Message | Bernd Reiß | 2025-08-29 13:16:28 | Re: Use-after-free in expand_partitioned_rtentry |