暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Failed to write to mysql.slow_log

DBA闲思杂想录 2021-12-09
831

最近将一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。[1] 摘抄其中一段描述内容如下:

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掉,在这之前从未碰到过,第一次遇到也颇感意外,遇到了就记录一下!

参考资料

[1]

Bug #37132 Logging to slow_log table fails with very slow queries: https://bugs.mysql.com/bug.php?id=37132


文章转载自DBA闲思杂想录,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论