• Marko Mäkelä's avatar
    MDEV-24445 Using innodb_undo_tablespaces corrupts system tablespace · 0c23e32d
    Marko Mäkelä authored
    In the rewrite of MDEV-8139 (based on MDEV-15528), we introduced a
    wrong assumption that any persistent tablespace that is not an .ibd
    file is the system tablespace. This assumption is broken when
    innodb_undo_tablespaces (files undo001, undo002, ...) are being used.
    By default, we have innodb_undo_tablespaces=0 (the persistent undo
    log is being stored in the system tablespace).
    
    In MDEV-15528 and MDEV-8139 we rewrote the page scrubbing logic
    so that it will follow the tried-and-true write-ahead logging
    protocol, first writing FREE_PAGE records and then in the page
    flushing, zerofilling or hole-punching freed pages.
    
    Unfortunately, the implementation included a wrong assumption that
    that anything that is not in an .ibd file must be the system tablespace.
    This wrong assumption would cause overwrites of valid data pages in
    the system tablespace.
    
    mtr_t::m_freed_in_system_tablespace: Remove.
    
    mtr_t::m_freed_space: The tablespace associated with m_freed_pages.
    
    buf_page_free(): Take the tablespace and page number as a parameter,
    instead of taking a page identifier.
    0c23e32d
buf0buf.h 77 KB