Xtrabackup 8.0 failed to restore backup from mysql5.7

I am trying to backup mysql5.7 and restore it to mysql8.0, I did the following:

  1. start a percona-mysql-server-5.7 (5.7.42-46)container
  2. take backup of 5.7 instance using xtrabackup2.4
  3. copy the backup files to percona-mysql-server-8.0.31 container
  4. in 8.0.31 container, using xtrabackup8.0( 8.0.31-24 ) to restore the 5.7 backup

I got the following errors when doing “xtrabackup --prepare”

 xtrabackup --prepare --target-dir=/tmp/backup/
Defaulted container "mysql" out of: mysql, mysql-sidecar, mysqld-exporter
xtrabackup: [Warning] option 'innodb_undo_tablespaces': unsigned value 0 adjusted to 2.
2023-06-30T05:00:12.351559-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized server arguments: --innodb_checksum_algorithm=crc32 --innodb_data_file_path=ibdata1:12M:autoextend --innodb_log_files_in_group=2 --innodb_log_file_size=50331648 --innodb_page_size=16384 --innodb_log_block_size=512 --innodb_undo_directory=./ --innodb_undo_tablespaces=0 --server-id=0 
2023-06-30T05:00:12.352130-00:00 0 [Note] [MY-011825] [Xtrabackup] recognized client arguments: --prepare=1 --target-dir=/tmp/backup/ 
xtrabackup version 8.0.31-24 based on MySQL server 8.0.31 Linux (x86_64) (revision id: f0754edb)
2023-06-30T05:00:12.352265-00:00 0 [Note] [MY-011825] [Xtrabackup] cd to /tmp/backup/
2023-06-30T05:00:12.352679-00:00 0 [Note] [MY-011825] [Xtrabackup] This target seems to be not prepared yet.
2023-06-30T05:00:12.356929-00:00 0 [ERROR] [MY-011825] [Xtrabackup] Unsupported redo log format 1
2023-06-30T05:00:12.356983-00:00 0 [ERROR] [MY-011825] [Xtrabackup] This version of Percona XtraBackup can only perform backups and restores against MySQL 8.0 and Percona Server 8.0, please use Percona Xtrabackup 2.4 for this database.
command terminated with exit code 1

It seems xtrabackup8.0 doesn’t have compatibility with mysql5.7, I checked the document , this should be supported

Hi @xhaiwei .

Xtrabackup does not support you prepare backup from previous major version on the 8.0 series. You should run the --prepare phase from your 5.7 backup using 2.4 xtrabackup and than restore it on 8.0 server.

If you can point where in the documentation we state this path is supported, I can get it updated.

Hi @Marcelo_Altmann
Thank you, I successfully prepared 5.7 backup, and tried to restore it on 8.0 server, but I got this error

2023-07-06T02:06:12.459414-00:00 0 [ERROR] [MY-011825] [Xtrabackup] cannot open file './xtrabackup_tablespaces'
2023-07-06T02:06:12.459464-00:00 0 [ERROR] [MY-011825] [Xtrabackup] failed to load tablespaces list.
2023-07-06T02:06:12.459474-00:00 0 [ERROR] [MY-011825] [Xtrabackup] It is possible that the backup was created by Percona XtraBackup 2.4 or earlier version. Please use the same XtraBackup version to restore.

It says I need to use XtraBackup 2.4 to restore, the 8.0 server is running in a container with XtraBackup8.0 installed, can I do remote restore with XtraBackup2.4? It seems the --host option can only used in taking backup?

You cannot remote restore. --copy-back or --move-back need direct access to the files.

Btw, this error you mentioned is from --prepare correct?
If you already prepared the backup with 2.4, now you just need to start 8.0 MySQL server using that backup as your datadir.

Hi @Marcelo_Altmann

Thank you for your comment.
The error I got is from the restore command. I have successfully prepared the backup.
I also tried to restart from 8.0 Mysql, but it told me the backup is taken from xtrabackup 2.4, I need to restore from xtrabackup2.4 too. So I need to install xtrabackup2.4 on 8.0 Mysql server?