Re: pgsql: Move named LWLock tranche requests to shared memory.

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Nathan Bossart <nathan(at)postgresql(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Move named LWLock tranche requests to shared memory.
Date: 2025-09-17 14:34:24
Message-ID: aMrG8F-NkiedEugc@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, Sep 17, 2025 at 01:47:19PM +0900, Michael Paquier wrote:
> Perhaps LocalNamedLWLockTrancheRequestArray should be initialized to
> NULL when declared, and I'd rather document the reasons behind what
> this patch is doing in LWLockShmemSize() and when the state is
> initialized in CreateLWLocks(), than have the reader assume why the
> local pointer is needed (aka reinitialized with restart_after_crash).

I've added some commentary to this effect in v3.

> Note: I forgot for a second if shared_preload_libraries was reloaded
> when the postmaster reinitializes a cluster, and the answer is that
> we only go into process_shared_preload_libraries() once at startup..
> I was wondering for a second about a potential case where s_p_l is
> updated with more lwlocks added in-between, where a reinitialization
> would mess up things.

Yeah, this stuff is rather precarious, and I'm a bit surprised there
haven't been more problems in this area.

--
nathan

Attachment Content-Type Size
v3-0001-Fix-re-initialization-of-LWLock-related-shared-me.patch text/plain 2.7 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-09-17 20:33:10 pgsql: Calculate agglevelsup correctly when Aggref contains a CTE.
Previous Message Michael Paquier 2025-09-17 04:47:19 Re: pgsql: Move named LWLock tranche requests to shared memory.