On Wed, Jun 6, 2012 at 3:07 PM, Andres Freund <andres@2ndquadrant.com> wrote:
> Hm. For a short while I thought there would be an issue with heap_delete and
> IOS because the deleting transaction can commit without any barriers happening
> on the IOS side. But that only seems to be possible with non MVCC snapshots
> which are currently not allowed with index only scans.
Well, one, commits are irrelevant; the page ceases to be all-visible
as soon as the delete happens. And two, you can't do a delete or a
commit without a memory barrier - every LWLockAcquire() or
LWLockRelease() is a full barrier, so any operation that requires a
buffer content lock is both preceded and followed by a full barrier.
Proposed patch attached. This adds some more comments in various
places, and implements your suggestion of retesting the visibility-map
bit when we detect a possible mismatch with the page-level bit.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company