||
问题描述
MySQL 5.7.21 业务表无法访问,select 业务表直接导致mysql crash,errorlog 里记录 [ERROR] InnoDB: Page [page id: space=49, page number=3] log sequence number 89266322606 is in the future! Current system log sequence number 89266322472.
此处为个人环境模拟复现的错误日志
2024-03-28T20:07:50.690100+08:00 0 [ERROR] InnoDB: Page [page id: space=49, page number=3] log sequence number 89266322606 is in the future! Current system log sequence number 89266322472.
2024-03-28T20:07:50.690140+08:00 0 [ERROR] 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/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
查看5.7.21源码:
当 ib_logfile 中记录的 current_lsn < 数据页 page_lsn,报如下错误 Page [page id: space=49, page number=3] log sequence number 89266322606 is in the future! Current system log sequence number 89266322472.
造成该错误的原因:您的数据库可能已损坏,或者您可能已经复制了InnoDB表空间,但没有复制InnoDB日志文件。
可能触发的几个场景:
表数据访问不了,有什么特殊解决办法?
既然是 ib_logfile 中记录的 current_lsn 数据页 page_lsn。
查询 current_lsn ,直至满足 current_lsn > 数据页 page_lsn
mysql -uroot -e 'SHOW ENGINE INNODB STATUS;' \
| sed 's/\\n/\n/g' \
| grep '^Log sequence'
推进current_lsn > 数据页 page_lsn后,数据访问恢复正常。
合作电话:010-64087828
社区邮箱:greatsql@greatdb.com