Seems I was too optimistic in supposing that sinval's maxMsgNum could be
commit822cc9c58345cdfe625156be737a178c3d77d0db
authortgl <tgl>
Fri, 20 Jun 2008 00:24:53 +0000 (20 00:24 +0000)
committertgl <tgl>
Fri, 20 Jun 2008 00:24:53 +0000 (20 00:24 +0000)
tree40ce2f0ee24a1fa9fecac29b260511a671157967
parent3f64154c7467f788a50afe92894e9bac8ff8fd53
Seems I was too optimistic in supposing that sinval's maxMsgNum could be
read and written without a lock.  The value itself is atomic, sure, but on
processors with weak memory ordering it's possible for a reader to see the
value change before it sees the associated message written into the buffer
array.  Fix by introducing a spinlock that's used just to read and write
maxMsgNum.  (We could do this with less overhead if we recognized a concept
of "memory access barrier"; is it worth introducing such a thing?  At the
moment probably not --- I can't measure any clear slowdown from adding the
spinlock, so this solution is probably fine.)  Per buildfarm results.
src/backend/storage/ipc/sinvaladt.c