Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
> ... MarkBufferDirty needs to be called
> before XLogInsert to avoid a race condition in checkpoint, see comments
> in SyncOneBuffer in bufmgr.c for an explanation.
Right, see also the "Write-Ahead Log coding" section in
src/backend/access/transam/README (which is maybe not a very good place
for it, but it doesn't seem like bufmgr's turf either).
regards, tom lane