如果我在解压缩不相关的文件的同时运行插入/更新查询,则查询将挂起,直到文件解压缩为止。
为什么会这样,和/或我该如何进一步调试呢?
测试:
表
CREATE TABLE `test` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`test` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
制作一个测试zip文件
fallocate -l 3G test.img && zip test.zip test.img && rm test.img
将其解压缩以进行测试
while true; do rm -f test.img && unzip test.zip; done
同时:插入或更新一些数据
mysql> INSERT INTO test(test) VALUES(1);
Query OK, 1 row affected (17,43 sec)
mysql> UPDATE test SET test=2 WHERE id=1;
Query OK, 1 row affected (13,52 sec)
Rows matched: 1 Changed: 1 Warnings: 0
查询将挂起,并且仅在解压缩/取消处理后立即结束。
mysql错误日志显示不足为奇
tail /var/log/mysql/error.log
[Note] InnoDB: page_cleaner: 1000ms intended loop took 27710ms. The settings might not be optimal. (flushed=2 and evicted=0, during the time.)
[Note] InnoDB: page_cleaner: 1000ms intended loop took 16426ms. The settings might not be optimal. (flushed=11 and evicted=0, during the time.)
[Note] InnoDB: page_cleaner: 1000ms intended loop took 6190ms. The settings might not be optimal. (flushed=1 and evicted=0, during the time.)
我尝试运行nice unzip..
来取消优先级解压缩,因为它以80-100%cpu的速度运行,但结果相同。而且我在mysql 5.7中找不到任何信息/错误