• Marko Mäkelä's avatar
    MDEV-22169 Recovery fails after failing to insert into mlog_init · 1738c0f1
    Marko Mäkelä authored
    In a multi-batch recovery, we must ensure that INIT_PAGE and
    especially the MDEV-15528 FREE_PAGE records will be taken
    properly into account.
    
    Writing a FREE_PAGE record gives the server permission to omit
    a page write. If recovery insists on applying log to a page
    whose page flush has been omitted, then the consistency checks
    in the application of high-level redo log records (appending
    an undo log record, inserting or deleting an index record)
    will likely fail.
    
    mlog_init_t::add(): Return whether the state was changed.
    
    mlog_init_t::will_avoid_read(): Determine whether a page read
    will be avoided and whether older log records can be safely
    skipped.
    
    recv_sys_t::parse(): Even if store==STORE_NO, process the records
    INIT_PAGE and FREE_PAGE. While processing them, we can delete older
    redo log records for the page. If store!=STORE_NO, we can directly
    skip redo log recods of other types if mlog_init indicates that the
    page will be freed or initialized by at a later LSN.
    
    This fix was developed in cooperation with
    Thirunarayanan Balathandayuthapani.
    1738c0f1
log0recv.cc 106 KB