postgres.git / summary / log / commit / refs
commit 8551a289201c79d84bf8d43be2c3c93c95205497
Author: Nathan Bossart <nathan@postgresql.org>
Date: Wed Nov 26 17:37:21 2025 +0000
First released in: 17.8, 18.2
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."
This reverts commit 1165a933aa (and the corresponding commits on
the back-branches). In a follow-up commit, we'll teach the
registry to retry entry initialization instead of leaving it in a
permanently failed state.
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/E1vJHUk-006I7r-37%40gemulon.postgresql.org
Backpatch-through: 17
src/backend/storage/ipc/dsm_registry.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/backend/storage/ipc/dsm_registry.c b/src/backend/storage/ipc/dsm_registry.c
index 8511b7afc7b..1d4fd31ffed 100644
--- a/src/backend/storage/ipc/dsm_registry.c
+++ b/src/backend/storage/ipc/dsm_registry.c
@@ -45,7 +45,6 @@ typedef struct DSMRegistryEntry
char name[64];
dsm_handle handle;
size_t size;
- bool initialized;
} DSMRegistryEntry;
static const dshash_parameters dsh_params = {
@@ -159,12 +158,8 @@ GetNamedDSMSegment(const char *name, size_t size,
entry = dshash_find_or_insert(dsm_registry_table, name, found);
if (!(*found))
{
- dsm_segment *seg;
-
- entry->initialized = false;
-
/* Initialize the segment. */
- seg = dsm_create(size, 0);
+ dsm_segment *seg = dsm_create(size, 0);
dsm_pin_segment(seg);
dsm_pin_mapping(seg);
@@ -174,17 +169,13 @@ GetNamedDSMSegment(const char *name, size_t size,
if (init_callback)
(*init_callback) (ret);
-
- entry->initialized = true;
}
- else if (!entry->initialized)
- ereport(ERROR,
- (errmsg("requested DSM segment \"%s\" failed initialization",
- name)));
else if (entry->size != size)
+ {
ereport(ERROR,
- (errmsg("requested DSM segment \"%s\" does not match size of existing entry",
- name)));
+ (errmsg("requested DSM segment size does not match size of "
+ "existing segment")));
+ }
else
{
dsm_segment *seg = dsm_find_mapping(entry->handle);
[parent: 2f9ec456aece]