From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | introduce dynamic shared memory registry |
Date: | 2023-12-05 03:46:47 |
Message-ID: | 20231205034647.GA2705267@nathanxps13 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Every once in a while, I find myself wanting to use shared memory in a
loadable module without requiring it to be loaded at server start via
shared_preload_libraries. The DSM API offers a nice way to create and
manage dynamic shared memory segments, so creating a segment after server
start is easy enough. However, AFAICT there's no easy way to teach other
backends about the segment without storing the handles in shared memory,
which puts us right back at square one.
The attached 0001 introduces a "DSM registry" to solve this problem. The
API provides an easy way to allocate/initialize a segment or to attach to
an existing one. The registry itself is just a dshash table that stores
the handles keyed by a module-specified string. 0002 adds a test for the
registry that demonstrates basic usage.
I don't presently have any concrete plans to use this for anything, but I
thought it might be useful for extensions for caching, etc. and wanted to
see whether there was any interest in the feature.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
v1-0001-add-dsm-registry.patch | text/x-diff | 9.8 KB |
v1-0002-test-dsm-registry.patch | text/x-diff | 7.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2023-12-05 03:47:08 | Re: Use PGAlignedBlock instead of "char buf[BLCKSZ]" in more places |
Previous Message | Richard Guo | 2023-12-05 03:40:53 | Re: Rename ShmemVariableCache and initialize it in more standard way |