mysql ddl 导致tmp空间溢出并报错
1.版本
1)操作系统
cat /etc/issue
cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m
cat /proc/version
cat /proc/version
Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014
2)mysql数据库版本
MySQL --version
mysql Ver 14.14 Distrib 5.6.26, for linux-glibc2.5 (x86_64) using EditLine wrapper
2.问题描述
2.1 发现问题
收到从库复制状态报警,show slave status\G;显示报错信息如下:
Last_Errno: 1034Last_Error: Error 'Incorrect key file for table 'test_s'; try to repair it' on query. Default database: 'dbs1'. Query: 'alter table test add service_code varchar(64) COMMENT '业务编码''Skip_Counter: 0Exec_Master_Log_Pos: 547897990Relay_Log_Space: 631033469Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 1034Last_SQL_Error: Error 'Incorrect key file for table 'test_s'; try to repair it' on query. Default database: 'dbs1'. Query: 'alter table test_s add service_code varchar(64) COMMENT '业务编码''
3. 分析问题
只通过上面的报错信息,我们很难确定具体是什么问题,所以我们继续查看mysql的error log。errorlog中相关报错信息如下:
2017-01-20 11:00:05 7fcc44742700 InnoDB: Error: Write to file (merge) failed at offset 10558111744.
InnoDB: 1048576 bytes should have been written, only 843776 were written.
InnoDB: Operating system error number 0.
InnoDB: Check that your OS and file system support files of this size.
InnoDB: Check also that the disk is not full or a disk quota exceeded.
InnoDB: Error number 0 means 'Success'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/operating-system-error-codes.html
2017-01-20 11:00:06 27657 [ERROR] Slave SQL: Error 'Incorrect key file for table 'test_s'; try to repair it' on query. Default database: 'dbs1'. Query: 'alter table test_s add service_code varchar(64) COMMENT '业务编码'', Error_code: 1034
2017-01-20 11:00:06 27657 [Warning] Slave: Incorrect key file for table 'test_s'; try to repair it Error_code: 1034
2017-01-20 11:00:06 27657 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log '3306-bin.000167' position 547897990
从errorlog的报错信息,我们很容易看出来是在给表add column的时候,磁盘空间满了,导致add column操作失败报错。关于mysql 各种ddl操作需要的空间问题,我会在另一篇博客中进行介绍。
4.问题解决方案
知道了问题原因,处理就很简单了df -h找到使用率100%的挂在目录,然后添加磁盘空间(或者修改mysql tmpdir参数,如果是因为临时文件导致的话)
##mysql online ddl不但会在表所在目录下生成两个中间文件,而且会在tmpdri指定目录下生成临时排序文件,排序文件大概需要两倍表大小的空间(注意ls无法查看到这些临时排序文件,可以通过lsof|grep deleted观察)
ALTER TABLE
operations that rebuild an InnoDB
table using the ALGORITHM=INPLACE
technique (online DDL) also create temporary sort files in the MySQL temporary directory ($TMPDIR
on Unix, %TEMP%
on Windows, or the directory specified by the --tmpdir
configuration option).
参考:
https://dev.mysql.com/doc/refman/5.6/en/temporary-files.html
mysql ddl 导致tmp空间溢出并报错相关推荐
- mysql中大数据表alter增加字段报错:1034 Incorrect key file for table 'table_name'; try to repair it...
mysql中大数据表alter增加字段报错:"1034 Incorrect key file for table 'table_name'; try to repair it" 现 ...
- mysql 5.6 主主复制_Percona MySQL 5.6 主主复制环境报错Got fatal error 1236 from master.....
Percona MySQL 5.6 主主复制环境报错: mysql> show slave status\G *************************** 1. row ******* ...
- mysql远程一会不用卡住_连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的,...
连接远程MySQL数据库项目启动时,不报错但是卡住不继续启动的, 2018-03-12 17:08:52.532DEBUG[localhost-startStop-1]o.s.beans.factor ...
- 未指定的IO标准导致vivado生成bit文件报错
1.1 未指定的IO标准导致vivado生成bit文件报错 1.1.1 本节目录 1)本节目录: 2)本节引言: 3)FPGA简介: 4)未指定的IO标准导致vivado生成bit文件报错: 5)结束 ...
- mysql 安装1364_安装完MySQL,在配置最后一步报错error Nr.1364
[原文:http://www.mysqlperformanceblog.com/2014/01/28/10-mysql-settings-to-tune-after-installation/基本配置 ...
- IDEA(2018)连接MySQL数据库失败的解决方法(报错08001)
IDEA(2018)连接MySQL数据库失败的解决方法(报错08001) 参考文章: (1)IDEA(2018)连接MySQL数据库失败的解决方法(报错08001) (2)https://www.cn ...
- Mysql解决微信特殊符号昵称入库报错乱码
Mysql解决微信特殊符号昵称入库报错乱码 目录: Mysql解决微信特殊符号昵称入库报错乱码 环境声明 思考乱码原因 怎么解决 解决自己代码和微信编码统一 解决代码传输到数据库,序列化反序列化问题 ...
- mysql 8.0.21 对用户授权报错 near ‘IDENTIFIED BY ‘123456‘ with grant option‘ at line 1
mysql 8.0.21 对用户授权报错 near 'IDENTIFIED BY '123456' with grant option' at line 1 问题描述 mysql在创建用户,对用户授权 ...
- 思迅软件端口不通导致软件和软锁报错的问题
一.端口不通导致软件和软锁报错的问题 问题说明:打开软件提示到:xxx.xxx.xxx.xxx失败! 处理步骤1: 假设软锁服务器IP为192.168.0.1,分别在服务器本机和客户端电脑测试软锁服务 ...
最新文章
- OVS数据库操作(四十七)
- Openssl和PKCS#11的故事
- Oracle的存储过程和存储函数
- [OS复习]进程互斥与同步1
- Android之MVVM框架 - 数据绑定
- 《人月神话》阅读笔记03
- linux/ubuntu查看内核版本命令
- 每日算法系列【LeetCode 123】买卖股票的最佳时机 III
- 科罗拉多大学波尔得分校计算机科学,科罗拉多大学波尔得分校排名
- 传奇客户端wil文件说明
- Java中9种常见的CMS GC问题分析与解决
- 移动营业厅前台设备如何安装+新手引导
- xp系统怎么看计算机内存条,XP环境下怎么查看虚拟内存?XP系统虚拟内存过低怎么设置?...
- 跨考计算机要选择408吗,408难度比较大,对于跨考更是如此,应从以下三个方面做准备...
- 嵌入式技术学习路线分享
- Flutter键盘弹出造成布局异常解决
- 图像的灰度增强、去噪、图像增强
- 使用 Cipher CipherInputStream CipherOutputStream 实现对文件的加解密
- 认知无线电网络架构与协议体系
- 基于Matlab的脉冲多普勒雷达仿真