TransactionIdSetPageStatus() calls TransactionIdSetStatusBit(), which writes an 8 byte variable (the lsn). That's not safe.
Agreed, thanks for spotting that.
I see this as the biggest problem to overcome with this patch.
How about using 64bit atomics or spinlock to protect this variable?
Spinlock is out IMHO because this happens on every clog lookup. So it must be an atomic read.
I'm wondering if its worth making this work on 32-bit systems at all. The contention problems only occur on higher end servers, so we can just disable this optimization if we aren't on a 64bit server.
--
Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services