Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent
Date: 2025-11-24 21:25:51
Message-ID: aSTNXyXnr9HYsLo6@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Nov 24, 2025 at 04:02:18PM -0500, Robert Haas wrote:
> I haven't done a full review of this and I'm not sure whether you want
> me to spend more time on it...

I'd appreciate an eyeball check if you have the time.

> I'm guessing that the reason why that doesn't easily work is
> because you're relying on those locks to prevent multiple backends
> from doing the same initialization?

For GetNamedDSMSegment(), I bet we could avoid needing a PG_CATCH by taking
the DSMRegistryLock exclusively when accessing the registry. But for
GetNamedDSA() and GetNamedDSHash(), we want to keep the half-initialized
entry so that we don't leak LWLock tranche IDs. I initially thought that
might be okay, but if every backend is retrying, you could quickly run out
of tranche IDs.

--
nathan

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-11-24 22:00:29 pgsql: Improve detection of implicitly-temporary views.
Previous Message Robert Haas 2025-11-24 21:02:18 Re: pgsql: Teach DSM registry to ERROR if attaching to an uninitialized ent

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-11-24 21:28:54 Re: [PATCH] Add memory usage reporting to VACUUM VERBOSE
Previous Message Pavel Stehule 2025-11-24 21:19:10 Re: proposal: schema variables