• Marko Mäkelä's avatar
    MDEV-26450: Corruption due to innodb_undo_log_truncate · 1cb218c3
    Marko Mäkelä authored
    At least since commit 055a3334
    (MDEV-13564) the undo log truncation in InnoDB did not work correctly.
    
    The main issue is that during the execution of
    trx_purge_truncate_history() some pages of the newly truncated
    undo tablespace could be discarded.
    
    fsp_try_extend_data_file(): Apply the peculiar rounding of
    fil_space_t::size_in_header only to the system tablespace,
    whose size can be expressed in megabytes in a configuration parameter.
    Other files may freely grow by a number of pages.
    
    fseg_alloc_free_page_low(): Do allow the extension of undo tablespaces,
    and mention the file name in the error message.
    
    mtr_t::commit_shrink(): Implement crash-safe shrinking of a tablespace
    file. First, durably write the log, then shrink the file, and finally
    release the page latches of the rebuilt tablespace. Refactored from
    trx_purge_truncate_history().
    
    log_write_and_flush_prepare(), log_write_and_flush(): New functions
    to durably write log during mtr_t::commit_shrink().
    1cb218c3
trx0purge.cc 48.7 KB