agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
Subject: [PATCH v1 1/2] Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."
Date: Mon, 24 Nov 2025 11:03:52 -0600

This reverts commit 1165a933aab1355757a43cfd9193b6cce06f573b.
---
 src/backend/storage/ipc/dsm_registry.c | 34 +++-----------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/src/backend/storage/ipc/dsm_registry.c b/src/backend/storage/ipc/dsm_registry.c
index 7eba8a8cffb..a926b9c3f32 100644
--- a/src/backend/storage/ipc/dsm_registry.c
+++ b/src/backend/storage/ipc/dsm_registry.c
@@ -93,7 +93,6 @@ typedef struct DSMRegistryEntry
 {
 	char		name[NAMEDATALEN];
 	DSMREntryType type;
-	bool		initialized;
 	union
 	{
 		NamedDSMState dsm;
@@ -217,7 +216,6 @@ GetNamedDSMSegment(const char *name, size_t size,
 		dsm_segment *seg;
 
 		entry->type = DSMR_ENTRY_TYPE_DSM;
-		entry->initialized = false;
 
 		/* Initialize the segment. */
 		seg = dsm_create(size, 0);
@@ -230,21 +228,13 @@ GetNamedDSMSegment(const char *name, size_t size,
 
 		if (init_callback)
 			(*init_callback) (ret);
-
-		entry->initialized = true;
 	}
 	else if (entry->type != DSMR_ENTRY_TYPE_DSM)
 		ereport(ERROR,
-				(errmsg("requested DSM segment \"%s\" does not match type of existing entry",
-						name)));
-	else if (!entry->initialized)
-		ereport(ERROR,
-				(errmsg("requested DSM segment \"%s\" failed initialization",
-						name)));
+				(errmsg("requested DSM segment does not match type of existing entry")));
 	else if (entry->dsm.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
 	{
 		NamedDSMState *state = &entry->dsm;
@@ -307,7 +297,6 @@ GetNamedDSA(const char *name, bool *found)
 		NamedDSAState *state = &entry->dsa;
 
 		entry->type = DSMR_ENTRY_TYPE_DSA;
-		entry->initialized = false;
 
 		/* Initialize the LWLock tranche for the DSA. */
 		state->tranche = LWLockNewTrancheId(name);
@@ -319,17 +308,10 @@ GetNamedDSA(const char *name, bool *found)
 
 		/* Store handle for other backends to use. */
 		state->handle = dsa_get_handle(ret);
-
-		entry->initialized = true;
 	}
 	else if (entry->type != DSMR_ENTRY_TYPE_DSA)
 		ereport(ERROR,
-				(errmsg("requested DSA \"%s\" does not match type of existing entry",
-						name)));
-	else if (!entry->initialized)
-		ereport(ERROR,
-				(errmsg("requested DSA \"%s\" failed initialization",
-						name)));
+				(errmsg("requested DSA does not match type of existing entry")));
 	else
 	{
 		NamedDSAState *state = &entry->dsa;
@@ -390,7 +372,6 @@ GetNamedDSHash(const char *name, const dshash_parameters *params, bool *found)
 		dsa_area   *dsa;
 
 		entry->type = DSMR_ENTRY_TYPE_DSH;
-		entry->initialized = false;
 
 		/* Initialize the LWLock tranche for the hash table. */
 		dsh_state->tranche = LWLockNewTrancheId(name);
@@ -408,17 +389,10 @@ GetNamedDSHash(const char *name, const dshash_parameters *params, bool *found)
 		/* Store handles for other backends to use. */
 		dsh_state->dsa_handle = dsa_get_handle(dsa);
 		dsh_state->dsh_handle = dshash_get_hash_table_handle(ret);
-
-		entry->initialized = true;
 	}
 	else if (entry->type != DSMR_ENTRY_TYPE_DSH)
 		ereport(ERROR,
-				(errmsg("requested DSHash \"%s\" does not match type of existing entry",
-						name)));
-	else if (!entry->initialized)
-		ereport(ERROR,
-				(errmsg("requested DSHash \"%s\" failed initialization",
-						name)));
+				(errmsg("requested DSHash does not match type of existing entry")));
 	else
 	{
 		NamedDSHState *dsh_state = &entry->dsh;
-- 
2.39.5 (Apple Git-154)


--RrQwG/d5bOC9SOJ1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v1-0002-handle-ERRORs-in-DSM-registry-functions.patch



view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1 1/2] Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."
  In-Reply-To: <no-message-id-31252@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox