]> granicus.if.org Git - postgresql/commit
Clean up WAL/buffer interactions as per my recent proposal. Get rid of the
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Mar 2006 23:32:07 +0000 (23:32 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Mar 2006 23:32:07 +0000 (23:32 +0000)
commita8b8f4db23cff16af50a2b960cb8d20d39b761cf
tree224f8cb0da7e2e17ccfd7b8a030db1664acd46c1
parent89395bfa6f2fafccec10be377fcf759030910654
Clean up WAL/buffer interactions as per my recent proposal.  Get rid of the
misleadingly-named WriteBuffer routine, and instead require routines that
change buffer pages to call MarkBufferDirty (which does exactly what it says).
We also require that they do so before calling XLogInsert; this takes care of
the synchronization requirement documented in SyncOneBuffer.  Note that
because bufmgr takes the buffer content lock (in shared mode) while writing
out any buffer, it doesn't matter whether MarkBufferDirty is executed before
the buffer content change is complete, so long as the content change is
completed before releasing exclusive lock on the buffer.  So it's OK to set
the dirtybit before we fill in the LSN.
This eliminates the former kluge of needing to set the dirtybit in LockBuffer.
Aside from making the code more transparent, we can also add some new
debugging assertions, in particular that the caller of MarkBufferDirty must
hold the buffer content lock, not merely a pin.
24 files changed:
src/backend/access/gist/gist.c
src/backend/access/gist/gistvacuum.c
src/backend/access/gist/gistxlog.c
src/backend/access/hash/hashovfl.c
src/backend/access/hash/hashpage.c
src/backend/access/heap/heapam.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtree.c
src/backend/access/nbtree/nbtxlog.c
src/backend/access/transam/README
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogutils.c
src/backend/catalog/index.c
src/backend/commands/sequence.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/storage/buffer/README
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/localbuf.c
src/include/access/hash.h
src/include/access/nbtree.h
src/include/storage/buf_internals.h
src/include/storage/bufmgr.h