mysql報錯Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage


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;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM