菜单 学习猿地 - LMONKEY

VIP

开通学习猿地VIP

尊享10项VIP特权 持续新增

知识通关挑战

打卡带练!告别无效练习

接私单赚外块

VIP优先接,累计金额超百万

学习猿地私房课免费学

大厂实战课仅对VIP开放

你的一对一导师

每月可免费咨询大牛30次

领取更多软件工程师实用特权

入驻
481
0

mysql报错Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage

原创
05/13 14:22
阅读数 62281

mysql报错Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage

 

在执行create table  xx  as  select xx的时候

或者在执行

tpcc-mysql的tpcc_load 的时候

都会遇到这个错误

 

1534, HY000, Writing one row to the row-based binary log failed
Retrying ...

1197, HY000, Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mysqld variable and try again
Retrying ...

 

 

因为使用的是腾讯云主机,1核1G内存,内存不足导致的binlog cache size不够不能写入binlog,导致语句无法执行

 

解决办法:

修改my.cnf,增大binlog_cache_size和max_binlog_cache_size参数的值

binlog_cache_size = 20M
max_binlog_cache_size = 100M

 


今天备份表数据遇到一个错误  Error CODE: 1197 Multi-statement TRANSACTION required more THAN 'max_binlog_cache_size' bytes of STORAGE

 

 

版本:mysql5.6.35

系统:centos6.5

下面是备份语句

CREATE TABLE FONTANA_BETSBAK AS SELECT * FROM FONTANA_BETS; 

 

 

Error CODE: 1197
Multi-statement TRANSACTION required more THAN 'max_binlog_cache_size' bytes of STORAGE; increase this mysqld variable AND try again

 

 

上网搜了一下,发现是max_binlog_cache_size设置得不够大的原因

对Innodb引擎
由于innodb是事务型的,所以会把load文件的整个操作当作一个事务来处理,
中途中断load操作,会导致回滚。 
与此相关的一些参数:
max_binlog_cache_size----能够使用的最大cache内存大小。
当执行多语句事务时,max_binlog_cache_size如果不够大,
系统可能会报出“Multi-statement
transaction required more than 'max_binlog_cache_size' bytes of storage”的错误。
 备注:以load data 来说,如果load的文件大小为512M,在执行load 的过程中,
所有产生的binlog会先写入binlog_cache_size,直到load data 的操作结束后,
最后,再由binlog_cache_size 写入二进制日志,如mysql-bin.0000008等。
所以此参数的大小必须大于所要load 的文件的大小,或者当前所要进行的事务操作的大小。

 

改大max_binlog_cache_size 和binlog_cache_size  问题解决

SET GLOBAL max_binlog_cache_size =20971520;
SET GLOBAL binlog_cache_size =20971520;

 

发表评论

0/200
481 点赞
0 评论
收藏
为你推荐 换一批