• Marko Mäkelä's avatar
    MDEV-18976 Implement OPT_PAGE_CHECKSUM log record for improved validation · 4179f93d
    Marko Mäkelä authored
    We will introduce an optional log record OPT_PAGE_CHECKSUM for recording
    page checksums, so that more inconsistencies on crash recovery may be
    caught.
    
    mtr_t::page_checksum(const buf_page_t&): Write OPT_PAGE_CHECKSUM
    (currently not for ROW_FORMAT=COMPRESSED pages).
    
    mtr_t::do_write(): Write OPT_PAGE_CHECKSUM records for all pages
    (currently, in debug builds only).
    
    mtr_t::is_logged(): Return whether log should be written.
    
    mtr_t::set_log_mode_sub(const mtr_t&): Set the logging mode of
    a sub-minitransaction when another mini-transaction is holding
    latches on some modified pages. When creating or freeing BLOB pages,
    we may only write OPT_PAGE_CHECKSUM records in the main mini-transaction,
    after all changes have been written to the log.
    
    MTR_LOG_SUB: Log mode for a sub-mini-transaction.
    
    mtr_t::free(): Define non-inline, and invoke MarkFreed.
    
    MarkFreed: For any matching page in the mini-transaction log,
    change the first entry to say MTR_MEMO_PAGE_X_MODIFY and any subsequent
    entries to MTR_MEMO_PAGE_X_FIX.
    
    FindModified: Simplify a condition. MTR_MEMO_MODIFY can only be set
    if MTR_MEMO_PAGE_X_FIX or MTR_MEMO_PAGE_SX_FIX are set.
    
    FindBlockX: Consider also MTR_MEMO_PAGE_X_MODIFY.
    
    recv_sys_t::parse(): Store OPT_PAGE_CHECKSUM records.
    
    log_phys_t::apply(): Validate OPT_PAGE_CHECKSUM records.
    
    log_phys_t::page_checksum(): Validate an OPT_PAGE_CHECKSUM record.
    
    Tested by: Matthias Leich
    4179f93d
page0zip.cc 138 KB