mirror of
https://github.com/postgres/postgres.git
synced 2026-03-04 22:32:20 -05:00
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 |
||
|---|---|---|
| .. | ||
| .gitignore | ||
| backendid.h | ||
| block.h | ||
| buf.h | ||
| buf_internals.h | ||
| buffile.h | ||
| bufmgr.h | ||
| bufpage.h | ||
| checksum.h | ||
| checksum_impl.h | ||
| condition_variable.h | ||
| copydir.h | ||
| dsm.h | ||
| dsm_impl.h | ||
| fd.h | ||
| freespace.h | ||
| fsm_internals.h | ||
| indexfsm.h | ||
| ipc.h | ||
| item.h | ||
| itemid.h | ||
| itemptr.h | ||
| large_object.h | ||
| latch.h | ||
| lmgr.h | ||
| lock.h | ||
| lockdefs.h | ||
| lwlock.h | ||
| off.h | ||
| pg_sema.h | ||
| pg_shmem.h | ||
| pmsignal.h | ||
| predicate.h | ||
| predicate_internals.h | ||
| proc.h | ||
| procarray.h | ||
| proclist.h | ||
| proclist_types.h | ||
| procsignal.h | ||
| reinit.h | ||
| relfilenode.h | ||
| s_lock.h | ||
| shm_mq.h | ||
| shm_toc.h | ||
| shmem.h | ||
| sinval.h | ||
| sinvaladt.h | ||
| smgr.h | ||
| spin.h | ||
| standby.h | ||
| standbydefs.h | ||