I Use Xtrabackup to backup several of my MySQL backups (all 8.0.39).
They all use an identical script.
The initial backup is:
xtrabackup ${MySQLConnectionString} --backup --slave-info --extra-lsndir="${LogsDir}" --target-dir="${CurrentDir}" --lock-ddl --no-server-version-check --register-redo-log-consumer
and the incremental backups are done by
xtrabackup ${MySQLConnectionString} --backup --slave-info --safe-slave-backup --extra-lsndir="${LogsDir}" --target-dir="${NewDir}" --incremental-basedir="${BaseDir}" --lock-ddl --no-server-version-check --register-redo-log-consumer
I then have a restore script to test the restore process. This runs:
xtrabackup --prepare --apply-log-only --target-dir="${backup_dir}/1/"
and each incremental backup is restored with
xtrabackup --prepare --target-dir="${backup_dir}/1" --incremental-dir="${backup_dir}/${n}"
and finally the last incremental backup is applied with
xtrabackup --prepare --target-dir="${backup_dir}/1" --incremental-dir="${backup_dir}/${x}"
This works fine on all of my databases, apart from one. During the restore it always fails to prepare backup days 3 onwards.
So Day 1 is fine (initial backup)
Day 2 is fine (incremental backup)
On Day 3, and all subsequent days it simply reports:
[Note] [MY-011825] [Xtrabackup] This target seems to be already prepared. [ERROR] [MY-011825] [Xtrabackup] applying incremental backup needs target prepared with --apply-log-only.
Can anyone shed some light on what it is looking for that is missing on Day 3 (or is there but shouldn’t be). e.g. what is it looking for that tells it it has “already been prepared”. As far as I can tell there is no difference between any of my databases, but clearly there is something different.