mysql bug( InnoDB: Error number 22),表突然不能读取

mysql bug( InnoDB: Error number 22),表突然不能读取

bug

最开始的bug:表突然不能读取

html 复制代码
2024-03-06 15:06:11 2024-03-06T07:06:11.137389Z 17 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2024-03-06 15:06:11 2024-03-06T07:06:11.137394Z 17 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2024-03-06 15:06:11 2024-03-06T07:06:11.137397Z 17 [ERROR] InnoDB: File ./webbuild/sys_config.frm: 'stat' returned OS error 122.

关闭mysql容器,再次重启失败

html 复制代码
2024-03-06 15:07:25 2024-03-06T07:07:25.883653Z 0 [ERROR] InnoDB: Operating system error number 22 in a file operation.
2024-03-06 15:07:25 2024-03-06T07:07:25.883688Z 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2024-03-06 15:07:25 2024-03-06T07:07:25.883695Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2024-03-06 15:07:25 2024-03-06T07:07:25.883698Z 0 [ERROR] InnoDB: File .//ib_buffer_pool: 'stat' returned OS error 122.
2024-03-06 15:07:25 2024-03-06T07:07:25.883703Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2024-03-06 15:07:25 2024-03-06T07:07:25.883877Z 0 [ERROR] InnoDB: Cannot open '/var/lib/mysql/ib_buffer_pool.incomplete' for writing: Invalid argument
2024-03-06 15:07:26 2024-03-06T07:07:26.585788Z 0 [ERROR] InnoDB: Operating system error number 5 in a file operation.
2024-03-06 15:07:26 2024-03-06T07:07:26.585931Z 0 [ERROR] InnoDB: Error number 5 means 'Input/output error'
2024-03-06 15:07:26 2024-03-06T07:07:26.585953Z 0 [Note] InnoDB: Some operating system error numbers are described at http://dev.mysql.com/doc/refman/5.7/en/operating-system-error-codes.html
2024-03-06 15:07:26 2024-03-06T07:07:26.585967Z 0 [ERROR] InnoDB: File ./ib_logfile0: 'Linux aio' returned OS error 105. Cannot continue operation
2024-03-06 15:07:26 2024-03-06T07:07:26.585975Z 0 [ERROR] InnoDB: Cannot continue operation.
2024-03-05 13:42:51 2024-03-05 05:42:51+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2024-03-05 13:42:51 2024-03-05 05:42:51+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2024-03-05 13:42:51 2024-03-05 05:42:51+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.44-1.el7 started.
2024-03-05 13:42:52 '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'

解决方案

不重建容器的几种可能措施

关键的信息:

  • File ./webbuild/sys_config.frm: 'stat' returned OS error 122.
  • Operating system error number 22 in a file operation.
  • File .//ib_buffer_pool : 'stat' returned OS error 122.
  • Cannot open '/var/lib/mysql/ib_buffer_pool.incomplete' for writing: Invalid argument
  • File ./ib_logfile0 : 'Linux aio' returned OS error 105. Cannot continue operation
  • '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'

查了下,有以下几种可能:

  • dokcer在windows上的文件系统兼容问题('Linux aio'),重启docker(优先建议这种方法,docker引擎在window很容易出问题)
  • 我的sys_config表的stat字段有问题,移除它的表文件
  • 容器内存不够,mysql的缓存页空间不足(ib_buffer_pool),docker update扩容
  • logfile文件问题:备份并移除logfile文件(./ib_logfile0)

除了重启没试过,其他试了都没有,我就重建容器了(因为其他容器正常就没第一时间怀疑docker),后面还是重启docker解决

重建容器

重建

html 复制代码
docker run  --env=MYSQL_ROOT_PASSWORD=xxxx --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env=GOSU_VERSION=1.16 --env=MYSQL_MAJOR=5.7 --env=MYSQL_VERSION=5.7.44-1.el7 --env=MYSQL_SHELL_VERSION=8.0.35-1.el7 --volume=E:\volume\mysql\mysql5.7\conf:/etc/mysql/conf.d --volume=E:\volume\mysql\mysql5.7\data:/var/lib/mysql --volume=E:\volume\mysql\mysql5.7\log:/var/log --volume=/var/lib/mysql -p 3306:3306 --restart=no --runtime=runc --memory="1073741824" -d mysql:5.7

如果懒得打命令或者忘记命令

2种方式:

  • docker desktop软件
  • docker commit

可能的run bug:xxxx file exists.

html 复制代码
docker: Error response from daemon: error while creating mount source path '/run/desktop/mnt/host/e/volume/mysql/mysql5.7/data': mkdir /run/desktop/mnt/host/e: file exists.

docker在windows上的兼容问题,将docker重启一下,再次run ,ok
(说明最开始的mysql bug应该就是docker的文件系统兼容问题,应该重启docker就行,不用重建)

相关推荐
.痞老板.11 小时前
mysql初阶--增删改查操作
数据库·mysql
浮生若城17 小时前
MySQL:库与表的操作
数据库·mysql
翔云1234561 天前
RocksDB中,客户端每写入一次数据,需要访问几次磁盘
运维·数据库·mysql
在多学一点1 天前
MYSQL第二次作业
android·数据库·mysql
yeccheng1 天前
MySQL 索引超详解:从底层 B+ 树到面试高频考点
java·开发语言·jvm·mysql·面试
骑着蜗牛撵大象3271 天前
MySQL 8.0 迁移后 SQL 变慢:执行计划里 3 类被忽略的成本差异
android·数据库·sql·mysql·优化器·执行计划
拖累斯2 天前
Jenkins + Python 全自动跑通「禅道任务/BUG 导出 → 月度开发考核表」
python·jenkins·bug
.痞老板.2 天前
mysql初阶--数据类型
android·数据库·mysql
Risehuxyc2 天前
MySQL密码插件
数据库·mysql
寂寞的船2 天前
【Unity Bug挑战】第10期 SerializeReference 内存泄漏之谜
unity·c#·游戏引擎·bug