I just happened to look into bufmgr.c for the first time in awhile, and
noticed the privaterefcount-is-no-longer-a-simple-array stuff. It doesn't
look too well thought out to me. In particular, PinBuffer_Locked calls
GetPrivateRefCountEntry while holding a buffer-header spinlock. That
seems completely unacceptable. It's certainly a huge violation of our
design principle that spinlocks should be held for only a few
instructions; and I rather suspect that a palloc failure down inside the
hashtable entry-allocation code would leave things in a bad state. It's
also depressing that the very common code path ReleaseBuffer->UnpinBuffer
results in a double search of the array/hashtable; that should be
refactored to avoid that.
regards, tom lane