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

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-25T21:16:00Z
Lists: pgsql-hackers

Attachments

On Tue, Nov 25, 2025 at 03:58:47PM -0500, Robert Haas wrote:
> On Tue, Nov 25, 2025 at 12:45 PM Nathan Bossart
> <nathandbossart@gmail.com> wrote:
>> I gave your idea a try, and I like the result a lot.  IMHO it makes the
>> code much easier to reason about.
> 
> I looked through this and I agree this looks good. Thanks for working on it.

My tests seem happy, so I will plan on committing these patches tomorrow.
The only difference in v4 is that pg_get_dsm_registry_allocations() will no
longer show partially-initialized entries.  I thought that was the best
option in this case because such entries shouldn't have any allocated
memory, and retrying GetNamed*() would set *found to false.

-- 
nathan

Commits

  1. Teach DSM registry to retry entry initialization if needed.

  2. Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."

  3. Teach DSM registry to ERROR if attaching to an uninitialized entry.