• Marko Mäkelä's avatar
    MDEV-13311 Presence of old logs in 10.2.7 will corrupt restored instance (change in behavior) · 1b478a7a
    Marko Mäkelä authored
    Mariabackup 10.2.7 would delete the redo log files after a successful
    --prepare operation. If the user is manually copying the prepared files
    instead of using the --copy-back option, it could happen that some old
    redo log file would be preserved in the restored location. These old
    redo log files could cause corruption of the restored data files when
    the server is started up.
    
    We prevent this scenario by creating a "poisoned" redo log file
    ib_logfile0 at the end of the --prepare step. The poisoning consists
    of simply truncating the file to an empty file. InnoDB will refuse
    to start up on an empty redo log file.
    
    copy_back(): Delete all redo log files in the target if the source
    file ib_logfile0 is empty. (Previously we did this if the source
    file is missing.)
    
    SRV_OPERATION_RESTORE_EXPORT: A new variant of SRV_OPERATION_RESTORE
    when the --export option is specified. In this mode, we will keep
    deleting all redo log files, instead of truncating the first one.
    
    delete_log_files(): Add a parameter for the first file to delete,
    to be passed as 0 or 1.
    
    innobase_start_or_create_for_mysql(): In mariabackup --prepare,
    tolerate an empty ib_logfile0 file. Otherwise, require the first
    redo log file to be longer than 4 blocks (2048 bytes). Unless
    --export was specified, truncate the first log file at the
    end of --prepare.
    1b478a7a
log0recv.cc 97 KB