Re: introduce dynamic shared memory registry
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2023-12-20T00:02:04Z
Lists: pgsql-hackers
On Tue, Dec 19, 2023 at 10:19:11AM -0600, Nathan Bossart wrote: > On Fri, Dec 08, 2023 at 04:36:52PM +0900, Michael Paquier wrote: >> Yes, tracking that in a more central way can have many usages, so your >> patch sounds like a good idea. Note that we have one case in core >> that be improved and make use of what you have here: autoprewarm.c. > > I'll add a patch for autoprewarm.c. Even if we don't proceed with that > change, it'll be a good demonstration. Cool, thanks. It could just be a separate change on top of the main one. > > +dsm_registry_init_or_attach(const char *key, void **ptr, size_t size, > > + void (*init_callback) (void *ptr)) > > > > This is shaped around dshash_find_or_insert(), but it looks like you'd > > want an equivalent for dshash_find(), as well. > > What is the use-case for only verifying the existence of a segment? One case I was thinking about is parallel aggregates that can define combining and serial/deserial functions, where some of the operations could happen in shared memory, requiring a DSM, and where each process doing some aggregate combining would expect a DSM to exist before making use of it. So a registry wrapper for dshash_find() could be used as a way to perform sanity checks with what's stored in the registry. -- Michael
Commits
-
Fix possible NULL pointer dereference in GetNamedDSMSegment().
- 4372adfa24f2 17.0 landed
-
Teach autoprewarm to use the dynamic shared memory registry.
- abb0b4fc03fc 17.0 landed
-
Introduce the dynamic shared memory registry.
- 8b2bcf3f287c 17.0 landed
-
doc: Reorganize section for shared memory and LWLocks.
- 964152c476f2 17.0 landed