暂无图片
分享
徐扬
2020-03-15
binlog日志增量还原数据库进程状态出现system lock等待

mysql5.6版本,centos7环境,通过xtrabackup全备加应用后续binlog日志还原mysql库,全备还原很顺利,binlog日志用mysqlsqlbinlog转换成sql脚本source执行,3G大的sql脚本跑了6个小时还没结束,执行过程非常缓慢,查看进程经常出现system lock状态,请教各位大神问题出现的可能原因。截屏20200315下午10.53.24.png

收藏
分享
6条回答
默认
最新
田弼元

sql数量很多,建议先看看iostat,是不是IO真的吃不消了

暂无图片 评论
暂无图片 有用 0
外包DBA

为啥要先转成sql脚本呢?
可以试试直接恢复~

暂无图片 评论
暂无图片 有用 0
徐扬

昨晚自己跑了8个小时终于恢复完了,恢复时看过iostat并不高,以为是开了event_scheduler的原因造成system lock,但是关闭之后重新跑sql还是报这个问题,总之谢谢各位专家

暂无图片 评论
暂无图片 有用 0
Rock Yan

出现system lock很正常,只要有表级锁就会出现,这跟你日志中执行的SQL内容有直接关系,在应用日志时这种信息很常见,通常都是很快的过去了,有的很快就没了,有的很长,你去从库看,通常在复制的时候show slave status结果 这种system lock也很多。
官方文档对system lock说的也不是很详细:

The thread has called mysql_lock_tables() and the thread state has not been updated since. This is a very general state that can occur for many reasons.
For example, the thread is going to request or is waiting for an internal or external system lock for the table. This can occur when InnoDB waits for a table-level lock during execution of LOCK TABLES. If this state is being caused by requests for external locks and you are not using multiple mysqld servers that are accessing the same MyISAM tables, you can disable external system locks with the --skip-external-locking option. However, external locking is disabled by default, so it is likely that this option will have no effect. For SHOW PROFILE, this state means the thread is requesting the lock (not waiting for it).

暂无图片 评论
暂无图片 有用 0
徐扬

好的,之前没太留意,后面我再多观察观察,谢谢!

暂无图片 评论
暂无图片 有用 0
徐扬
问题已关闭: 问题已经得到解决
暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏