Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
-
None
Description
Restore of backups (created with XtraBackup/Maria Backup) into empty data directory is the only valid scenario where success may be guaranteed. In other words if data directory has leftover data/log files from old Server instance - various problems may occur.
Nevertheless, on practice restore into non-empty directory may easily succeed without any issues (despite being dangerous).
So far both xtrabackup and mariabackup 10.1 did generate empty log files during --prepare.
Thus if user does simple 'copy' of prepared backup into non-empty data directory - old logs would be most likely just overwritten.
Change in behavior:
Mariabackup 10.2.7 doesn't create empty log files and relies on --copy-back action executed by user. (which will delete old innodb log files, if any).
For situations where users don't follow mentioned recommendations (i.e. neither use --copy-back or make sure that data directory is empty before restore) - backups created mariabackup 10.2.7 are definitely expected to become inconsistent/corrupted. (because of presence of old leftover InnoDB logs).
Attachments
Issue Links
- causes
-
MDEV-17433 Allow InnoDB start up with empty ib_logfile0 from mariabackup --prepare
-
- Closed
-
I think that copying files directly is inherently unsafe, and the --copy-back option should be preferred.
If someone implements direct copying, they should use the appropriate options, such as rsync --delete. Yes, it would be nice to have some safety mechanism against this.
An option that I did not consider so far would be that --prepare truncates the ib_logfile0 to zero bytes on completion, and --copy-back will ignore this zero-length file in the prepared backup directory. Then, if the user copies files by low-level means, the zero-length ib_logfile0 should prevent server startup.
anikitin, did you imply something like that in your case 2? I do not see how else you would get a zero-length ib_logfile0 file. I think that InnoDB should refuse to start up with a zero-length redo log file. If not, we can implement that.
I provided the patch 0001-Mariabackup-Write-a-dummy-empty-redo-log-after-prepa.patch
to create a 'dummy' redo log file that does not change the system LSN. This is important, so that incremental backups will not be broken. This patch has not been tested much, and it changes the redo log format in an incompatible way. We cannot do that within a beta or GA release (MariaDB 10.2). Soon we cannot do that in MariaDB 10.3 either.