Bug #104105 after upgration from MySQL5.7 to MySQL8.0, there are many errors in errlog
Submitted: 24 Jun 14:33 Modified: 25 Jun 7:04
Reporter: Brian Yue (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0 OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[24 Jun 14:33] Brian Yue
Description:
Hello,
  We previously have a MySQL5.7.21 instance, and now we are upgrading it to MySQL8.0.18, after that, when I access data in that table, there are a lot of ERROR messages in error log.
  And I have ensured that MySQL5.7.21 instance has been shutdown normally with innodb_fast_shutdown = 0.

  An error message is like this:

2021-06-24T21:48:12.190799+08:00 1 [Note] [MY-012955] [InnoDB] Initializing buffer pool, total size = 32.000000G, instances = 16, chunk size =128.000000M
2021-06-24T21:48:12.792690+08:00 1 [Note] [MY-012957] [InnoDB] Completed initialization of buffer pool
2021-06-24T21:48:12.818312+08:00 0 [Note] [MY-011952] [InnoDB] If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-06-24T21:48:12.901125+08:00 1 [Note] [MY-013566] [InnoDB] Double write buffer files: 2
2021-06-24T21:48:12.901282+08:00 1 [Note] [MY-013565] [InnoDB] Double write buffer pages per instance: 16
2021-06-24T21:48:12.901465+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_0.dblwr' for doublewrite
2021-06-24T21:48:12.911259+08:00 1 [Note] [MY-013532] [InnoDB] Using './#ib_16384_1.dblwr' for doublewrite
2021-06-24T21:48:12.927688+08:00 1 [Note] [MY-012529] [InnoDB] Redo log format is v1. The redo log was created before MySQL 8.0.3.
2021-06-24T21:48:12.927831+08:00 1 [Note] [MY-012557] [InnoDB] Redo log is from an earlier version, v1.
2021-06-24T21:48:12.938811+08:00 1 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2021-06-24T21:48:12.939154+08:00 1 [Note] [MY-012532] [InnoDB] Applying a batch of 0 redo log records ...
2021-06-24T21:48:12.939289+08:00 1 [Note] [MY-012535] [InnoDB] Apply batch completed!
2021-06-24T21:48:12.939790+08:00 1 [Note] [MY-013041] [InnoDB] Upgrading redo log: 2*8589934592 bytes, LSN=1236862
2021-06-24T21:48:12.940087+08:00 1 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2021-06-24T21:48:12.959615+08:00 1 [Note] [MY-012968] [InnoDB] Starting to delete and rewrite log files.
2021-06-24T21:48:13.108320+08:00 1 [Note] [MY-013575] [InnoDB] Creating log file /home/ch6/data/redo/ib_logfile101
2021-06-24T21:48:13.108798+08:00 1 [Note] [MY-013575] [InnoDB] Creating log file /home/ch6/data/redo/ib_logfile1
2021-06-24T21:48:13.147367+08:00 1 [Note] [MY-012892] [InnoDB] Renaming log file /home/ch6/data/redo/ib_logfile101 to /home/ch6/data/redo/ib_logfile0
2021-06-24T21:48:13.147600+08:00 1 [Note] [MY-012893] [InnoDB] New log files created, LSN=1237004
2021-06-24T21:48:13.147757+08:00 1 [Note] [MY-013083] [InnoDB] Log background threads are being started...
2021-06-24T21:48:13.150893+08:00 1 [Note] [MY-013040] [InnoDB] Found 4 undo tablespaces that need to be upgraded. Will create 2 new undo tablespaces.
2021-06-24T21:48:13.151072+08:00 1 [Note] [MY-012910] [InnoDB] Opened 4 existing undo tablespaces.
2021-06-24T21:48:13.151905+08:00 1 [Note] [MY-012896] [InnoDB] Creating UNDO Tablespace /home/ch6/data/undo/undo_001
2021-06-24T21:48:13.152078+08:00 1 [Note] [MY-012897] [InnoDB] Setting file /home/ch6/data/undo/undo_001 size to 16 MB
2021-06-24T21:48:13.152238+08:00 1 [Note] [MY-012898] [InnoDB] Physically writing the file full
2021-06-24T21:48:13.178372+08:00 1 [Note] [MY-012896] [InnoDB] Creating UNDO Tablespace /home/ch6/data/undo/undo_002
2021-06-24T21:48:13.178568+08:00 1 [Note] [MY-012897] [InnoDB] Setting file /home/ch6/data/undo/undo_002 size to 16 MB
2021-06-24T21:48:13.178745+08:00 1 [Note] [MY-012898] [InnoDB] Physically writing the file full
2021-06-24T21:48:13.200146+08:00 1 [Note] [MY-012915] [InnoDB] Created 2 undo tablespaces.
2021-06-24T21:48:13.200451+08:00 1 [Note] [MY-011980] [InnoDB] GTID recovery trx_no: 0
2021-06-24T21:48:13.201519+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo004' Page [page id: space=4, page number=3] log sequence number 19191564 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.201724+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.202148+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo003' Page [page id: space=3, page number=4] log sequence number 21111656 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.202347+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.203203+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo003' Page [page id: space=3, page number=5] log sequence number 23685320 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.203414+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.203806+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo004' Page [page id: space=4, page number=5] log sequence number 24325716 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.204012+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.204592+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo003' Page [page id: space=3, page number=6] log sequence number 25607421 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.204811+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.205271+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo003' Page [page id: space=3, page number=27] log sequence number 25813925 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.205489+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.206056+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo004' Page [page id: space=4, page number=6] log sequence number 6390039 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.206278+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.211675+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo004' Page [page id: space=4, page number=7] log sequence number 25822181 is in the future! Current system log sequence number 1276084.
2021-06-24T21:48:13.211919+08:00 1 [ERROR] [MY-011972] [InnoDB] Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html for information about forcing recovery.
2021-06-24T21:48:13.212912+08:00 1 [ERROR] [MY-011971] [InnoDB] Tablespace 'innodb_undo004' Page [page id: space=4, page number=26] log sequence number 25822837 is in the future! Current system log sequence number 1276084.

    
  I have retried many times, errors always exist.

How to repeat:
(1) Install a MySQL5.7.21 instance.
(2) Create database, init 2 tables and records with sysbench-0.5. And each table is inited with 100,000 records. 
(3) Copy data dir (including data, redo, undo, binlog) to another host
(4) Install a MySQL8.0.21 instance and run basing on the data dir just copied in step (3).
(5) After MySQL started, check error log if there are error messages.
[25 Jun 7:04] MySQL Verification Team
Hi,

I followed your steps with a difference that I used the latest 5.7 and 8.0 and I don't see any of the issues you mention. 

Few rules you should be following (it is not always required but it is a best practice you should be following) when upgrading between major versions:
1. first upgrade your 5.7 to the latest 5.7 (5.7.34 today)
2. then upgrade to the latest 8.0 (8.0.25 today)
3. if migrating between servers make sure both servers have correct datetime synced with world ntpd servers

Thanks for your interest in MySQL