1

I tried to restore an old raw backup of databases (whole datadir) in MariaDB 10.11.5 but it didn't booted up. After that I found following lines in log:

[ERROR] InnoDB: File ./ib_logfile0 was not found
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

For over a decade I've been deleting log files on MySQL and MariaDB servers to adjust innodb-log-file-size or for making a raw backups and saving space. The next time the server was restarted, they were recreated automatically. But suddenly, not this time. And all because starting with version MariaDB 10.8.1, the presence of a ib_logfile0 became mandatory due to multiple changes (MDEV-27199) and (MDEV-14425). It's no longer automatically created, but strictly required.

I tried creating an empty log file, but that apparently didn't work and resulted in an error:

[ERROR] InnoDB: ib_logfile0 is empty, and LSN is unknown.
[ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption

After studying the tasks on jira, I got the strong feeling that there was no way to "regenerate" the log file as before. So, my main question is: is there any other ways out rather than restoring a backups on an older MariaDB version and backuping them properly for newer ones?

And what about creation of such "raw" backups on the newer versions? I've read that instead of deleting the log, you now must reduce the size of the log to save disk space. Probably, now it's the only way?

P.S It's very worth noting that starting from version 10.8.1 the log file size changes automatically when you change it in the configuration. And starting from version 10.9.0 - even at runtime (MDEV-27812).

1 Answer 1

3

TLDR; You may have lost data by deleting ib_logfile*. Don't delete them without it appearing in official documentation for the version being used and follow that to the letter.

The reason ib_logfile* files exist isn't because the MariaDB wanted to waste your space, it was because they where required to keep your data. This why starting with the ib_logfile0 was made mandatory, to catch users performing dangerous practices.

Without this redo log data written but not flushed would be lost and potentially your backups are missing recently change data because of this. This the flushing is what mariadb-backup --prepare (also required) does to ensure the data can be restored (unsure if this can be used on raw copy, but that would require your deleted files).

Your options now start potentially without data are:

  • Start MariaDB with 10.7.8, the last version of the now out of date 10.7 series and cleanly shutdown (containers are a good way to do this - podman run -v /place/of/datadir:/var/lib/mysql:Z mariadb:10.7).
  • start in innodb_read_only mode (from MDEV-27199), take a logical dump of the data and restore to a new version.
  • start with innodb_force_recovery=6.

Depending on which MariaDB version your backup was from, there are limits on the earlier MariaDB version that can start with this data. See notes from KB page on downgrading.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.