Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Alvaro Herrera wrote:
>> Right now we flip hint bits without taking any kind
>> of lock on the page.
> That's not quite true. You need to hold a shared lock on heap page to
> examine the visibility of a tuple, and that's when the hint bits are
> set. So we always hold at least a shared lock on the page while hint
> bits are set.
Right, but we couldn't let hint-bit-setters update the page LSN with
only shared lock. Too much chance of ending up with a scrambled LSN
value.
Could we arrange for the actual LSN-updating to be done while still
holding WALInsertLock? Then we'd be depending on that lock, not the
page-level locks, to serialize. It's not great to be pushing more work
inside that global lock, but it's not very much more work ...
regards, tom lane