Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Add a callback data parameter to GetNamedDSMSegment
Date: 2025-12-03 20:07:56
Message-ID: aTCYnALj87J_KOux@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 03, 2025 at 12:47:46PM -0600, Sami Imseih wrote:
> Can you provide more details on the use-case?

I think the main use-case is creating multiple DSM segments in the registry
that use the same initialization callback. I ran into this when I was
working on GetNamedDSA() and GetNamedDSHash(). In early versions of the
patch, the new functions used GetNamedDSMSegment() to allocate the space
for all the DSA/dshash information [0]. Since initializing those segments
required the user-provided name string, I ended up taking a lock after
calling GetNamedDSMSegment() and doing most of the initialization there.
My gut feeling is that this is an obscure enough use-case that this
workaround is probably sufficient, but I am interested to hear more...

[0] https://postgr.es/m/attachment/177621/v8-0001-simplify-creating-hash-table-in-dsm-registry.patch

--
nathan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benjamin Leff 2025-12-03 20:16:15 Re: Client-only Meson Build From Sources
Previous Message Ignat Remizov 2025-12-03 19:38:57 Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM