Bug #108063 data volumes from previous mysql versions doesn't work with 8.0.30
Submitted: 3 Aug 14:58 Modified: 4 Aug 12:34
Reporter: moshe yazdi Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0 OS:Any (CentOS7.9)
Assigned to: CPU Architecture:Any (Intel)
Tags: 8.0.30, Clone, disk, MySQL, older, snapshots, versions

[3 Aug 14:58] moshe yazdi
In my role I clone data disks to new mysql databases in order to create new slave replicas.
for that I'm taking a snapshot (aws ebs snapshot) of the the whole volume on one server, and attach it to the other server (before taking the snapshot i run 'flush tables with read lock').
this process is working well for all v5.7 and used to work perfectly on mysql 8.0.X as well.
I found that when cloning data from previous versions<8.0.30 to a MySQL v8.0.30
then, the 8.0.30 instance is failing to come up

log file: 
2022-08-03T13:59:01.297503Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 14872
2022-08-03T13:59:01.297571Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/usr/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2022-08-03T13:59:01.304615Z 0 [Warning] [MY-010075] [Server] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6d66f821-1334-11ed-8dd1-1212a6646005.
2022-08-03T13:59:01.309146Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2022-08-03T13:59:05.767170Z 1 [ERROR] [MY-012526] [InnoDB] Upgrade is not supported after a crash or shutdown with innodb_fast_shutdown = 2. This redo log was created with MySQL 8.0.23, and it appears logically non empty. Please follow the instructions at http://dev.mysql.com/doc/refman/8.0/en/upgrading.html
2022-08-03T13:59:05.767210Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2022-08-03T13:59:06.245200Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2022-08-03T13:59:06.245363Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2022-08-03T13:59:06.245384Z 0 [ERROR] [MY-010119] [Server] Aborting
2022-08-03T13:59:06.246270Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.

How to repeat:
clone a data volume from an older mysql version (<8.0.30) to a new server with mysql 8.0.30.


Suggested fix:
currently the only fix i found is to delete the redo logs (ib_logfile*), the binlogs and the binlog.index  
after that the server starts successfully.
[3 Aug 15:34] Jakub Lopuszanski
Do not delete redo logs unless you are fine with loosing your data - the redo logs contain changes which were not yet applied to tablespace files!

As the format of redo log files changed between 8.0.23 and 8.0.30 you can't boot MySQL 8.0.30 with non-empty redo log files created by 8.0.23.
However, you can do it if they are logically empty, i.e. do not contain any changes which are not yet applied to tablespaces.
For that to happen, you'd have to make sure that checkpoint LSN matches the last flushed lsn.
There are some ways to achieve it, but simply doing "flush tables with read lock" as you do is not enough.
One way would be to instead use the "flush tables..for export" https://dev.mysql.com/doc/refman/8.0/en/flush.html#flush-tables-for-export-with-list
[4 Aug 7:59] Jakub Lopuszanski
BTW. Why don't you use CLONE command?
[4 Aug 11:31] MySQL Verification Team
Hi Mr. yazdi,

Thank you for your bug report.

You have received a lot of necessary information regarding your problems.

Let us know if those resolve the issue or not ......
[4 Aug 12:34] MySQL Verification Team
Hi Mr. yazdi,

After careful analysis, we have concluded that you have not used proper and optimal set of commands in your upgrade process.

However, we have also agreed that our Manual is not clear enough on this issue.

Verified as a documentation bug.