]> granicus.if.org Git - postgresql/commit
Fix assert failure at end of recovery, broken by XLogInsert scaling patch.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 17 Jul 2013 19:57:48 +0000 (22:57 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 17 Jul 2013 20:12:22 +0000 (23:12 +0300)
commit59c02a36f0ef317958b2d14313b5c8e41cfd9be6
tree7b764ce11c5c050fe0a00c7491fa2dfb5a4e3a3b
parent3f2adace1ec025908b5189f0773b4eaab3d228d5
Fix assert failure at end of recovery, broken by XLogInsert scaling patch.

Initialization of the first XLOG buffer at end-of-recovery was broken for
the case that the last read WAL record ended at a page boundary. Instead of
trying to copy the last full xlog page to the buffer cache in that case,
just set shared state so that the next page is initialized when the first
WAL record after startup is inserted. (that's what we did in earlier
version, too)

To make the shared state required for that case less surprising, replace the
XLogCtl->curridx variable, which was the index of the latest initialized
buffer, with an XLogRecPtr of how far the buffers have been initialized.
That also allows us to get rid of the XLogRecEndPtrToBufIdx macro.

While we're at it, make a similar change for XLogCtl->Write.curridx, getting
rid of that variable and calculating the next buffer to write from
XLogCtl->LogwrtResult instead.
src/backend/access/transam/xlog.c