Teach DSM registry to ERROR if attaching to an uninitialized entry.
authorNathan Bossart <[email protected]>
Wed, 12 Nov 2025 20:30:11 +0000 (14:30 -0600)
committerNathan Bossart <[email protected]>
Wed, 12 Nov 2025 20:30:11 +0000 (14:30 -0600)
commitb26d76f643277973f90a62f18de30e00edd65378
tree7a8b88915d07a20f71df1291e3305621b18ffc14
parent82fa6b78dba1037a8822ea5fae1018376c10fd3c
Teach DSM registry to ERROR if attaching to an uninitialized entry.

If DSM entry initialization fails, backends could try to use an
uninitialized DSM segment, DSA, or dshash table (since the entry is
still added to the registry).  To fix, keep track of whether
initialization completed, and ERROR if a backend tries to attach to
an uninitialized entry.  We could instead retry initialization as
needed, but that seemed complicated, error prone, and unlikely to
help most cases.  Furthermore, such problems probably indicate a
coding error.

Reported-by: Alexander Lakhin <[email protected]>
Reviewed-by: Sami Imseih <[email protected]>
Discussion: https://postgr.es/m/dd36d384-55df-4fc2-825c-5bc56c950fa9%40gmail.com
Backpatch-through: 17
src/backend/storage/ipc/dsm_registry.c