Re: add function for creating/attaching hash table in DSM registry

Rahila Syed <rahilasyed90@gmail.com>

From: Rahila Syed <rahilasyed90@gmail.com>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Florents Tselai <florents.tselai@gmail.com>, Sami Imseih <samimseih@gmail.com>, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers@postgresql.org
Date: 2025-06-11T14:18:50Z
Lists: pgsql-hackers
> On Wed, Jun 11, 2025 at 07:15:56PM +0530, Rahila Syed wrote:
> >> How can one dsa_allocate in the same area as the returned dshash_table ?
> >> in other words: shouldn't the state->dsa_handle be returned somehow ?
> >
> > +1. FWIW, Having used the DSA apis in my code, I think having the
> registry
> > return
> > the mapped dsa address or dsa handle will benefit users who use
> dsa_allocate
> > to allocate smaller chunks within the dsa.
>
> I considered adding another function that would create/attach a DSA in the
> DSM registry, since that's already an intermediate step of dshash creation.
> We could then use that function to generate the DSA in GetNamedDSMHash().
> Would that work for your use-cases, or do you really need to use the same
> DSA as the dshash table for some reason?
>
>
This will work for me. Thank you for considering it.

Commits

  1. Fix cross-version upgrade test breakage from commit fe07100e82.

  2. Add GetNamedDSA() and GetNamedDSHash().

  3. Remove dynamic_shared_memory_type=none

  4. Introduce dynamic shared memory areas.

  5. Relax the requirement that all lwlocks be stored in a single array.