• Marko Mäkelä's avatar
    MDEV-21724: Optimize page_cur_insert_low() redo logging · 138cbec5
    Marko Mäkelä authored
    Inserting a record into an index page involves updating multiple
    fields in the page header as well as updating the next-record links
    and potentially updating fields related to the sparse page directory.
    
    Let us cover the insert operations by higher-level log records, to avoid
    'redundant' logging about the writes.
    
    The code for applying the high-level log records will check the
    consistency of the page thoroughly, to avoid crashes during recovery.
    We will refuse to replay the inserts if any inconsistency is detected.
    With innodb_force_recovery=1, recovery will continue, but the affected
    pages may be more inconsistent if some changes were omitted.
    
    mrec_ext_t: Introduce the EXTENDED record subtypes
    INSERT_HEAP_REDUNDANT, INSERT_REUSE_REDUNDANT,
    INSERT_HEAP_DYNAMIC, INSERT_REUSE_DYNAMIC.
    The record will explicitly identify the page type and whether
    the space will be allocated from PAGE_HEAP_TOP or reused from
    the PAGE_FREE list. It will also tell how many bytes to copy
    from the preceding record header and payload, and how to
    initialize the rest of the record header and payload.
    
    mtr_t::page_insert(): Write the high-level log records.
    
    log_phys_t::apply(): Parse the high-level log records.
    
    page_apply_insert_redundant(), page_apply_insert_dynamic():
    Apply the high-level log records.
    
    page_dir_split_slot(): Introduce a variant that does not write log
    nor deal with ROW_FORMAT=COMPRESSED pages.
    
    page_mem_alloc_heap(): Remove the mtr_t parameter
    
    page_cur_insert_rec_low(): Write log only via mtr_t::page_insert().
    138cbec5
log0recv.cc 105 KB