pgsql: Fix assert failure at end of recovery, broken by XLogInsert scal

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix assert failure at end of recovery, broken by XLogInsert scal
Date: 2013-07-17 20:24:06
Message-ID: E1UzYGc-0001jG-MM@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2013-07-17 20:37:52 pgsql: Fix variable names mentioned in comment to match the code.
Previous Message Heikki Linnakangas 2013-07-17 17:37:34 pgsql: Fix end-of-loop optimization in pglz_find_match() function.