• Marko Mäkelä's avatar
    MDEV-25683 Atomic DDL: With innodb_force_recovery=3 InnoDB: Trying to load... · dbd6c6dc
    Marko Mäkelä authored
    MDEV-25683 Atomic DDL: With innodb_force_recovery=3 InnoDB: Trying to load index but the index tree has been freed
    
    The purpose of the parameter innodb_force_recovery is to allow some
    data to be dumped from a corrupted database. Its values used to be
    as follows:
    
    innodb_force_recovery=0: normal (default)
    
    innodb_force_recovery=1: ignore (skip log for) corrupted pages or
    missing data files when applying the redo log
    
    innodb_force_recovery=2: additionally, disable background tasks
    (such as the purge of committed undo logs)
    
    innodb_force_recovery=3: additionally, disable the rollback of
    recovered incomplete (not committed or XA PREPARE) transactions
    
    innodb_force_recovery=4: same as 3 (since MDEV-19514 in MariaDB 10.5)
    
    innodb_force_recovery=5: additionally, do not process any undo log,
    disallow any writes, and force READ UNCOMMITTED isolation level
    
    innodb_force_recovery=6: additionally, pretend that ib_logfile0 does
    not exist (prevent any recovery). Never use this!
    
    The bad thing that happens with innodb_force_recovery=3 and
    innodb_force_recovery=4 is that also the rollback of any recovered
    DDL transaction will be skipped. This would break the DDL log recovery
    that was introduced in MDEV-17567.
    
    For one data directory sample, the DDL log recovery would hangs due to
    a conflict on the InnoDB SYS_TABLES table, because the lock holder
    transaction was not rolled back due to innodb_force_recovery=3.
    
    Fix: Make innodb_force_recovery=3 skip the DML transaction rollback only,
    and make innodb_force_recovery=4 (renamed to SRV_FORCE_NO_DDL_UNDO)
    behave like innodb_force_recovery=3 used to (skip the rollback of all
    recovered transactions, both DML and DDL).
    
    Startup with innodb_force_recovery=4 will be unaffected by this change.
    (There may be hangs, possibly preceded by messages about failing to
    load an index.)
    
    Side note: With innodb_force_recovery=5, any DDL log for InnoDB tables
    will be essentially ignored by InnoDB, but the server will start up.
    dbd6c6dc
dict0stats.cc 132 KB