• Vlad Lesin's avatar
    MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon... · 23833dce
    Vlad Lesin authored
    MDEV-24792 Assertion `!newest_lsn || fil_page_get_type(page)' failed upon MariaBackup prepare in buf_flush_init_for_writing with innodb_log_optimize_ddl=off
    
    fsp_free_page() writes MLOG_INIT_FREE_PAGE, but does not update page
    type. But fil_crypt_rotate_page() checks the type to understand if the
    page is freshly initialized, and writes dummy record(updates space id)
    to force rotation during recovery. This dummy record causes assertion
    crash when the page is flushed after recovery, as it's supposed
    that pages LSN is 0 for freshly initialized pages.
    
    The bug is similiar to MDEV-24695, the difference is that in 10.5 the
    assertion crashes during log record applying, but in 10.4 it crashes
    during page flushing.
    
    The fix could be in marking page as freed and not writing dummy record
    during keys rotation procedure for such marked pages. But
    bpage->file_page_was_freed is not consistent enough for release builds in
    10.4, and the issue is fixed in 10.5 and does not exist in 10.[23] as
    MLOG_INIT_FREE_PAGE was introduced since 10.4.
    
    So the better solution is just to relax the assertion and implement some
    additional property for freshly allocated pages, and check this property
    during pages flushing.
    
    The test is copied from MDEV-24695, the only change is in forcing pages
    flushing after each server start to cause crash in non-fixed code.
    
    There is no need to merge it to 10.5+, as the bug is already fixed by
    MDEV-24695.
    23833dce
innodb_encrypt_freed.test 4.28 KB