ITPub博客

首页 > 数据库 > MySQL > Warning | 1292:Truncated incorrect binlog_cache_size value:

Warning | 1292:Truncated incorrect binlog_cache_size value:

原创 MySQL 作者:5功啊 时间:2016-06-02 11:22:10 0 删除 编辑
binlog_cache_size的大小必须为4096的倍数,不然会有一个warning, “Warning | 1292 | Truncated incorrect binlog_cache_size value: '33792'”,然后向下取最接近n个4096的值。

官方文档上关于binlog_cache_size的描述如下:
binlog_cache_size
Command-Line Format --binlog_cache_size=#
System Variable Name binlog_cache_size
Variable Scope Global
Dynamic Variable Yes
Permitted Values (32-bit platforms) Type integer
Default 32768
Min Value 4096
Max Value 4294967295
Permitted Values (64-bit platforms) Type integer
Default 32768
Min Value 4096
Max Value 18446744073709551615

The size of the cache to hold changes to the binary log during a transaction. A binary log cache is allocated for each client if the server supports any transactional storage engines and if the server has the binary log enabled (--log-bin option). If you often use large transactions, you can increase this cache size to get better performance. The Binlog_cache_use and Binlog_cache_disk_use status variables can be useful for tuning the size of this variable. See Section 6.4.4, “The Binary Log”.

binlog_cache_size sets the size for the transaction cache only; the size of the statement cache is governed by the binlog_stmt_cache_size system variable.


实验:

mysql> select 4096/1024
    -> ;
+-----------+
| 4096/1024 |
+-----------+
|    4.0000 |
+-----------+
1 row in set (0.00 sec)

mysql> set global binlog_cache_size=1024*4;
Query OK, 0 rows affected (0.00 sec)

mysql> set global binlog_cache_size=1024*8;
Query OK, 0 rows affected (0.00 sec)

mysql> set global binlog_cache_size=1024*4*2;
Query OK, 0 rows affected (0.00 sec)

mysql> set global binlog_cache_size=1024*4*3;
Query OK, 0 rows affected (0.00 sec)

mysql> set global binlog_cache_size=1024*5;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+-----------------------------------------------------+
| Level   | Code | Message                                             |
+---------+------+-----------------------------------------------------+
| Warning | 1292 | Truncated incorrect binlog_cache_size value: '5120' |
+---------+------+-----------------------------------------------------+
1 row in set (0.00 sec)

mysql> set global binlog_cache_size=1024*6;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> set global binlog_cache_size=1024*7;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> set global binlog_cache_size=1024*9;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> set global binlog_cache_size=1024*10;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show variables like 'binlog_cache_size';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| binlog_cache_size | 8192  |
+-------------------+-------+
1 row in set (0.00 sec)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26735168/viewspace-2112732/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-07-07

  • 博文量
    38
  • 访问量
    32422