• Heikki Linnakangas's avatar
    Fix assert failure at end of recovery, broken by XLogInsert scaling patch. · 59c02a36
    Heikki Linnakangas authored
    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.
    59c02a36
xlog.c 341 KB