Multi-statement transaction required more than ‘max_binlog_cache_size‘ bytes of storage;

176 阅读1分钟

报错

n### Cause: java.sql.SQLException: Multi-statement transaction required more than ‘max_binlog_cache_size’ bytes of storage; increase this mysqld variable and try again\n; uncategorized SQLException; SQL state [HY000]; error code [1197]; Multi-statement transaction required more than ‘max_binlog_cache_size’ bytes of storage; increase this mysqld variable and try again; nested exception is java.sql.SQLException: Multi-statement transaction required more than ‘max_binlog_cache_size’ bytes of storage; increase this mysqld variable and try again

查询

经百度查询是提交事务大小超过 mysql binlog 大小。

我们都知道提交事务过程,先写入binlog,然后再提交处于commit事务状态。

解决办法:

SET GLOBAL max_binlog_cache_size = 4294967296; #40G

推荐最大设置为40G,

最大可能设置为 16EB (exabytes)。

但这样是治标不治本的解决方法,归根结底还是事务太大了,应当从业务角度去解决,避免出现大事务。