Failed to write to mysql.slow_log

 

   最近将一MySQL数据库的系统变量log_output从file调整为table后,偶尔会收到告警邮件,告警邮件内容为:

 

Failed to write to mysql.slow_log

 

查了一下这个问题,发现居然是一个Bug,其实出现这个错误是因为慢查询的SQL语句太长,导致插入mysql.slow_log系统表时超过字段的长度,所以在错误日志当中出现"Failed to write to mysql.slow_log"信息。官方文档的Bug信息为Bug #37132 Logging to slow_log table fails with very slow queries。 摘抄其中一段描述内容如下:

 

Fixed in 8.0.17.

Logging to the mysql.slow_log system table could fail when values

were to large for table columns. Now logging proceeds on a

best-effort basis, writing what information can be provided.

Otherwise, the row is discarded and a message is written to the error log.

 

这个Bug直到MySQL 8.0.17才被Fix掉,在这之前从未碰到过,第一次遇到也颇感意外,遇到了就记录一下!

 

参考资料:

https://bugs.mysql.com/bug.php?id=37132

扫描上面二维码关注我
如果你真心觉得文章写得不错,而且对你有所帮助,那就不妨帮忙“推荐"一下,您的“推荐”和”打赏“将是我最大的写作动力!
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.
原文地址:https://www.cnblogs.com/kerrycode/p/15664958.html