Thread: pgsql: Fix assert failure at end of recovery, broken by XLogInsert scal
pgsql: Fix assert failure at end of recovery, broken by XLogInsert scal
From
Heikki Linnakangas
Date:
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. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/59c02a36f0ef317958b2d14313b5c8e41cfd9be6 Modified Files -------------- src/backend/access/transam/xlog.c | 111 +++++++++++++++---------------------- 1 file changed, 45 insertions(+), 66 deletions(-)