🌐 AI搜索 & 代理 主页
Skip to content

Commit c7e0f26

Browse files
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."
This reverts commit 1165a93 (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
1 parent cbb69a6 commit c7e0f26

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

src/backend/storage/ipc/dsm_registry.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ typedef struct DSMRegistryEntry
4545
char name[64];
4646
dsm_handle handle;
4747
size_t size;
48-
bool initialized;
4948
} DSMRegistryEntry;
5049

5150
static const dshash_parameters dsh_params = {
@@ -159,12 +158,8 @@ GetNamedDSMSegment(const char *name, size_t size,
159158
entry = dshash_find_or_insert(dsm_registry_table, name, found);
160159
if (!(*found))
161160
{
162-
dsm_segment *seg;
163-
164-
entry->initialized = false;
165-
166161
/* Initialize the segment. */
167-
seg = dsm_create(size, 0);
162+
dsm_segment *seg = dsm_create(size, 0);
168163

169164
dsm_pin_segment(seg);
170165
dsm_pin_mapping(seg);
@@ -174,17 +169,13 @@ GetNamedDSMSegment(const char *name, size_t size,
174169

175170
if (init_callback)
176171
(*init_callback) (ret);
177-
178-
entry->initialized = true;
179172
}
180-
else if (!entry->initialized)
181-
ereport(ERROR,
182-
(errmsg("requested DSM segment \"%s\" failed initialization",
183-
name)));
184173
else if (entry->size != size)
174+
{
185175
ereport(ERROR,
186-
(errmsg("requested DSM segment \"%s\" does not match size of existing entry",
187-
name)));
176+
(errmsg("requested DSM segment size does not match size of "
177+
"existing segment")));
178+
}
188179
else
189180
{
190181
dsm_segment *seg = dsm_find_mapping(entry->handle);

0 commit comments

Comments
 (0)