• Marko Mäkelä's avatar
    MDEV-17433 Allow InnoDB start up with empty ib_logfile0 from mariabackup --prepare · 81a5b6cc
    Marko Mäkelä authored
    A prepared backup from Mariabackup does not really need to contain any
    redo log file, because all log will have been applied to the data files.
    
    When the user copies a prepared backup to a data directory (overwriting
    existing files), it could happen that the data directory already contained
    redo log files from the past. mariabackup --copy-back) would delete the
    old redo log files, but a user’s own copying script might not do that.
    To prevent corruption caused by mixing an old redo log file with data
    files from a backup, starting with MDEV-13311, Mariabackup would create
    a zero-length ib_logfile0 that would prevent startup.
    
    Actually, there is no need to prevent InnoDB from starting up when a
    single zero-length file ib_logfile0 is present. Only if there exist
    multiple data files of different lengths, then we should refuse to
    start up due to inconsistency. A single zero-length ib_logfile0 should
    be treated as if the log files were missing: create new log files
    according to the configuration.
    
    open_log_file(): Remove. There is no need to open the log files
    at this point, because os_file_get_status() already determined
    the size of the file.
    
    innobase_start_or_create_for_mysql(): Move the creation of new
    log files a little later, not when finding out that the first log
    file does not exist, but after finding out that it does not exist
    or it exists as a zero-length file.
    81a5b6cc
log_file_size.result 2.88 KB