postgresql/src/include/storage
Tom Lane b4fa938e9f Clean up shm_mq cleanup.
The logic around shm_mq_detach was a few bricks shy of a load, because
(contrary to the comments for shm_mq_attach) all it did was update the
shared shm_mq state.  That left us leaking a bit of process-local
memory, but much worse, the on_dsm_detach callback for shm_mq_detach
was still armed.  That means that whenever we ultimately detach from
the DSM segment, we'd run shm_mq_detach again for already-detached,
possibly long-dead queues.  This accidentally fails to fail today,
because we only ever re-use a shm_mq's memory for another shm_mq, and
multiple detach attempts on the last such shm_mq are fairly harmless.
But it's gonna bite us someday, so let's clean it up.

To do that, change shm_mq_detach's API so it takes a shm_mq_handle
not the underlying shm_mq.  This makes the callers simpler in most
cases anyway.  Also fix a few places in parallel.c that were just
pfree'ing the handle structs rather than doing proper cleanup.

Back-patch to v10 because of the risk that the revenant shm_mq_detach
callbacks would cause a live bug sometime.  Since this is an API
change, it's too late to do it in 9.6.  (We could make a variant
patch that preserves API, but I'm not excited enough to do that.)

Discussion: https://postgr.es/m/8670.1504192177@sss.pgh.pa.us
2017-08-31 15:10:24 -04:00
..
.gitignore When trace_lwlocks is used, identify individual lwlocks by name. 2015-09-11 14:01:39 -04:00
backendid.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
block.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
buf.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
buf_internals.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
buffile.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
bufmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
bufpage.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
checksum.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
checksum_impl.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
condition_variable.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
copydir.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
dsm.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
dsm_impl.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
fd.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
freespace.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
fsm_internals.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
indexfsm.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
ipc.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
item.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
itemid.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
itemptr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
large_object.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
latch.h Distinguish wait-for-connection from wait-for-write-ready on Windows. 2017-08-15 11:08:25 -04:00
lmgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
lock.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
lockdefs.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
lwlock.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
off.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_sema.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pg_shmem.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
pmsignal.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
predicate.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
predicate_internals.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
proc.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
procarray.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
proclist.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
proclist_types.h Update copyright via script for 2017 2017-01-03 13:48:53 -05:00
procsignal.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
reinit.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
relfilenode.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
s_lock.h Remove symbol WIN32_ONLY_COMPILER 2017-04-11 15:22:21 +02:00
shm_mq.h Clean up shm_mq cleanup. 2017-08-31 15:10:24 -04:00
shm_toc.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
shmem.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
sinval.h Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
sinvaladt.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
smgr.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
spin.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
standby.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
standbydefs.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00