Thomas Munro <thomas.mu...@enterprisedb.com> writes: > DSM segments have a concept of 'pinning'. Normally, segments are > destroyed when they are no longer mapped by any backend, using a > reference counting scheme. If you call dsm_pin_segment(segment), that > is disabled so that the segment won't be destroyed until the cluster > is shut down. It works by incrementing the reference count an extra > time.
> Please find attached a patch to add a corresponding operation > 'dsm_unpin_segment'. This gives you a way to ask for the segment to > survive only until you decide to unpin it, at which point the usual > reference counting semantics apply again. It decrements the reference > count, undoing the effect of dsm_pin_segment and destroying the > segment if appropriate. What happens if dsm_unpin_segment is called more times than dsm_pin_segment? Seems like you could try to destroy a segment that still has processes attached. I don't object to the concept, but you need a less half-baked implementation if you want to add this. I'd suggest separate counters for process attaches and pin requests, with code in dsm_unpin_segment to disallow decrementing the pin request count below zero, and segment destruction only when both counters go to zero. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers