List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:October 22 2010 12:40pm
Subject:Re: bzr commit into mysql-5.5-bugteam branch (alfranio.correia:3231)
Bug#57275
View as plain text  
Hi Luis,

Thank you for the review.
I agree with your suggestions and will commit a new patch soon.

Cheers.

On 10/22/2010 10:47 AM, Luís Soares wrote:
> Hi Alfranio,
>
>   the patch is pretty much OK, thanks. So I'll approve it informally.
>   I'll wait for the final patch on which this one builds on (ie,
> I'll wait for patch for BUG#56343 before formally approving this
> one).
>
> See some suggestions inline.
>
> Kind Regards,
> Luís
>
> On 10/12/2010 06:15 PM, Alfranio Correia wrote:
>> #At
> file:///home/acorreia/workspace.sun/repository.mysql.new/bzrwork/bug-57275/mysql-5.5-bugteam/
> based on revid:alfranio.correia@stripped
>>
>>   3231 Alfranio Correia	2010-10-12
>>        BUG#57275 binlog_cache_size affects trx- and stmt-cache and gets twice the
> expected memory
>>
>>        After the WL#2687, the binlog_cache_size and max_binlog_cache_size affect
> both the
>>        stmt-cache and the trx-cache. This means that the resource used is twice
> the amount
>>        expected/defined by the user.
>>
>>        The binlog_cache_use is incremented when the stmt-cache or the trx-cache
> is used
>>        and binlog_cache_disk_use is incremented when the disk space from the
> stmt-cache or the
>>        trx-cache is used. This behavior does not allow to distinguish which cache
> may be harming
>>        performance due to the extra disk accesses and needs to have its in-memory
> cache
>>        increased.
>>
>>        To fix the problem, we introduced two new options and status variables
> related to the
>>        stmt-cache:
>>
>>        Options:
>>
>>        . binlog_stmt_cache_size
>>        . max_binlog_stmt_cache_size
>>
>>        Status Variables:
>>
>>        . binlog_stmt_cache_use
>>        . binlog_stmt_cache_disk_use
>
> Please, for documentation effort purposes, please add a description
> for each new option and variable.
>
>>       @ include/my_sys.h
>>          Updated comments.
>>       @ mysql-test/extra/binlog_tests/binlog_cache_stat.test
>>          Updated test case to print out information on binlog_stmt_cache_use and
>>          binlog_stmt_cache_disk_use and take into account the new error message.
>>       @ mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
>>          Updated test case to print out information on the new status variables
>>          and take into account the new error message.
>>       @ mysql-test/r/mysqld--help-notwin.result
>>          Updated test case to print out information on the new options.
>>       @ mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result
>>          Updated test case to print out information on the new status variables
>>          and take into account the new error message.
>>       @ mysql-test/suite/binlog/r/binlog_row_cache_stat.result
>>          Updated test case to print out information on the new status variables
>>          and take into account the new error message.
>>       @ mysql-test/suite/binlog/r/binlog_stm_cache_stat.result
>>          Updated test case to print out information on the new status variables
>>          and take into account the new error message.
>>       @ mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
>>          Updated test case to appropriately set the new options and take
>>          into account the new error message.
>>       @ mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
>>          Updated test case to appropriately set the new options and take
>>          into account the new error message.
>>       @ mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
>>          Updated test case to appropriately set the new options and take
>>          into account the new error message.
>>       @ mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc
>>          Introduced test case to check the new option binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result
>>          Introduced test case to check the new option binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result
>>          Introduced test case to check the new option binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
>>          Introduced test case to check the new option
> max_binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test
>>          Introduced test case to check the new option binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test
>>          Introduced test case to check the new option binlog_stmt_cache_size.
>>       @ mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test
>>          Introduced test case to check the new option
> max_binlog_stmt_cache_size.
>>       @ sql/log.cc
>>          Set the size of the binlog cache and updated its cache and disk usage.
>>       @ sql/log.h
>>          Changed the signature of the set_write_error to identify the message to
> be printed
>>          out according to the type of the cache.
>>       @ sql/mysqld.cc
>>          Introduced the options and status variables.
>>       @ sql/mysqld.h
>>          Introduced the options and status variables.
>>       @ sql/share/errmsg-utf8.txt
>>          Introduced a new error message related to the stmt-cache.
>>       @ sql/sys_vars.cc
>>          Introduced the options.
>>
>>      removed:
>>        mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt
>>      added:
>>        mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc
>>        mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result
>>        mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result
>>        mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
>>        mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test
>>        mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test
>>        mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test
>>      modified:
>>        include/my_sys.h
>>        mysql-test/extra/binlog_tests/binlog_cache_stat.test
>>        mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
>>        mysql-test/r/mysqld--help-notwin.result
>>        mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result
>>        mysql-test/suite/binlog/r/binlog_row_cache_stat.result
>>        mysql-test/suite/binlog/r/binlog_stm_cache_stat.result
>>        mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
>>        mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
>>        mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
>>        sql/log.cc
>>        sql/log.h
>>        sql/mysqld.cc
>>        sql/mysqld.h
>>        sql/share/errmsg-utf8.txt
>>        sql/sys_vars.cc
>> === modified file 'include/my_sys.h'
>> --- a/include/my_sys.h	2010-08-09 08:32:50 +0000
>> +++ b/include/my_sys.h	2010-10-12 17:14:48 +0000
>> @@ -456,7 +456,8 @@ typedef struct st_io_cache		/* Used when
>>     IO_CACHE_CALLBACK pre_close;
>>     /*
>>       Counts the number of times, when we were forced to use disk. We use it to
>> -    increase the binlog_cache_disk_use status variable.
>> +    increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
>> +    variables.
>>     */
>>     ulong disk_writes;
>>     void* arg;				/* for use by pre/post_read */
>>
>> === modified file 'mysql-test/extra/binlog_tests/binlog_cache_stat.test'
>> --- a/mysql-test/extra/binlog_tests/binlog_cache_stat.test	2010-10-06 08:34:49
> +0000
>> +++ b/mysql-test/extra/binlog_tests/binlog_cache_stat.test	2010-10-12 17:14:48
> +0000
>> @@ -25,13 +25,17 @@ create table t2 (a int) engine=myisam;
>>   --echo **** Preparing the enviroment to check commit and its effect on
>>   --echo **** the binlog_cache_use and binlog_cache_disk_use.
>>   --echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Now we are going to create transactional changes which are long
> enough so
>>   --echo **** they will be flushed to disk...
>>   --echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   let $1=2000;
>>   disable_query_log;
>>   begin;
>> @@ -44,34 +48,45 @@ commit;
>>   enable_query_log;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Transactional changes which should not be flushed to disk and so
> should not
>>   --echo **** increase binlog_cache_disk_use.
>>   --echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Non-Transactional changes which should not be flushed to disk and
> so should not
>>   --echo **** increase binlog_cache_disk_use.
>> ---echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Mixed changes which should not be flushed to disk and so should
> not
>>   --echo **** increase binlog_cache_disk_use.
>> ---echo **** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   #
>>   # Checking abort.
>> @@ -79,13 +94,17 @@ show status like "binlog_cache_disk_use"
>>   --echo **** Preparing the enviroment to check abort and its effect on
>>   --echo **** the binlog_cache_use and binlog_cache_disk_use
>>   --echo **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Now we are going to create transactional changes which are long
> enough so
>>   --echo **** they will be flushed to disk...
>>   --echo **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   let $1=2000;
>>   disable_query_log;
>>   begin;
>> @@ -98,32 +117,43 @@ rollback;
>>   enable_query_log;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Transactional changes which should not be flushed to disk and so
> should not
>>   --echo **** increase binlog_cache_disk_use.
>>   --echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   rollback;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Non-Transactional changes which should not be flushed to disk and
> so should not
>>   --echo **** increase binlog_cache_disk_use.
>> ---echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   rollback;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>
>>   --echo **** Mixed changes which should not be flushed to disk and so should
> not
>>   --echo **** increase binlog_cache_disk_use.
>> ---echo **** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +--echo **** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use =
> 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>>   rollback;
>>   show status like "binlog_cache_use";
>>   show status like "binlog_cache_disk_use";
>> +show status like "binlog_stmt_cache_use";
>> +show status like "binlog_stmt_cache_disk_use";
>>   drop table t1, t2;
>>
>> === modified file 'mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test'
>> --- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test	2010-10-09
> 10:18:16 +0000
>> +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test	2010-10-12
> 17:14:48 +0000
>> @@ -25,11 +25,13 @@ call mtr.add_suppression("Unsafe stateme
>>
>>   let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE
> "max_binlog_cache_size", Value, 1);
>>   let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE
> "binlog_cache_size", Value, 1);
>> +let $old_max_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE
> "max_binlog_stmt_cache_size", Value, 1);
>> +let $old_binlog_stmt_cache_size= query_get_value(SHOW VARIABLES LIKE
> "binlog_stmt_cache_size", Value, 1);
>>
>>   SET GLOBAL max_binlog_cache_size = 4096;
>> -# Becuase of bug#55377, we have to set binlog_cache_size until the bug is
>> -# fixed.
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   disconnect master;
>>   connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
>>
>> @@ -47,14 +49,14 @@ connection master;
>>
>>   --echo *** Single statement on transactional table ***
>>   --disable_query_log
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   eval INSERT INTO t1 (a, data) VALUES (1,
>>        CONCAT($data, $data, $data, $data, $data));
>>   --enable_query_log
>>
>>   --echo *** Single statement on non-transactional table ***
>>   --disable_query_log
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   eval INSERT INTO t2 (a, data) VALUES (2,
>>          CONCAT($data, $data, $data, $data, $data, $data));
>>   --enable_query_log
>> @@ -74,7 +76,7 @@ eval INSERT INTO t2 (a, data) VALUES (5,
>>
>>   --echo *** Single statement on both transactional and non-transactional tables.
> ***
>>   --disable_query_log
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
>>                          t1.data = CONCAT($data, $data, $data, $data);
>>   --enable_query_log
>> @@ -103,11 +105,11 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (1, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (2, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (3, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (4, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (5, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (6, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (7, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (8, 's');
>> @@ -130,9 +132,9 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (14, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (15, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (16, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (17, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (18, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (19, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (20, 's');
>> @@ -148,7 +150,7 @@ if (`SELECT @@binlog_format = 'STATEMENT
>>   if (`SELECT @@binlog_format = 'ROW'`)
>>   {
>>     --disable_query_log
>> -  --error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +  --error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>     CREATE TABLE t4 SELECT * FROM t1;
>>     --enable_query_log
>>   }
>> @@ -162,9 +164,9 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (22, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (23, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (24, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (25, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (26, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (27, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (28, 's');
>> @@ -192,11 +194,11 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (1, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (2, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (3, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (4, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (5, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (6, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (7, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (8, 's');
>> @@ -221,11 +223,11 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (1, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (2, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (3, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (4, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (5, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (6, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (7, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (8, 's');
>> @@ -268,7 +270,7 @@ TRUNCATE TABLE t1;
>>
>>   BEGIN;
>>   --disable_query_log
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   eval CALL p1($data);
>>   --enable_query_log
>>   COMMIT;
>> @@ -277,7 +279,7 @@ TRUNCATE TABLE t1;
>>
>>   BEGIN;
>>   --disable_query_log
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   eval CALL p1($data);
>>   --enable_query_log
>>   ROLLBACK;
>> @@ -299,12 +301,12 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (1, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (2, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (3, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (4, $data);
>>   SAVEPOINT sv;
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (5, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (6, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (7, 's');
>>   --eval INSERT INTO t2 (a, data) VALUES (8, 's');
>> @@ -331,11 +333,11 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (2, $data);
>>   --eval INSERT INTO t2 (a, data) VALUES (3, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (4, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (5, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (6, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (7, $data);
>>   --eval UPDATE t2 SET data= CONCAT($data, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (8, 's');
>> @@ -351,7 +353,7 @@ BEGIN;
>>   --eval INSERT INTO t1 (a, data) VALUES (16, $data);
>>   --eval INSERT INTO t2 (a, data) VALUES (17, $data);
>>   --eval INSERT INTO t1 (a, data) VALUES (18, $data);
>> ---error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
>> +--error ER_TRANS_CACHE_FULL, ER_STMT_CACHE_FULL, ER_ERROR_ON_WRITE
>>   --eval INSERT INTO t1 (a, data) VALUES (19, $data);
>>   --enable_query_log
>>   COMMIT;
>> @@ -367,10 +369,13 @@ let $diff_statement= SELECT * FROM t1;
>>   --echo # [ On Slave ]
>>   SET GLOBAL max_binlog_cache_size = 4096;
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>
>>   source include/stop_slave.inc;
>>   source include/start_slave.inc;
>>   CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_cache_size' bytes of storage.*");
>> +CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_stmt_cache_size' bytes of storage.*");
>>   CALL mtr.add_suppression("Writing one row to the row-based binary log
> failed.*");
>>
>>   connection master;
>> @@ -385,6 +390,10 @@ connection master;
>>   --eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
>>   --replace_result $old_binlog_cache_size ORIGINAL_VALUE
>>   --eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
>> +--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
>> +--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
>> +--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
>> +--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
>>   disconnect master;
>>   connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
>>
>> @@ -415,6 +424,10 @@ source include/show_binlog_events.inc;
>>   --eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size
>>   --replace_result $old_binlog_cache_size ORIGINAL_VALUE
>>   --eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size
>> +--replace_result $old_max_binlog_stmt_cache_size ORIGINAL_VALUE
>> +--eval SET GLOBAL max_binlog_stmt_cache_size= $old_max_binlog_stmt_cache_size
>> +--replace_result $old_binlog_stmt_cache_size ORIGINAL_VALUE
>> +--eval SET GLOBAL binlog_stmt_cache_size= $old_binlog_stmt_cache_size
>>
>>   source include/stop_slave.inc;
>>   source include/start_slave.inc;
>>
>> === modified file 'mysql-test/r/mysqld--help-notwin.result'
>> --- a/mysql-test/r/mysqld--help-notwin.result	2010-09-30 13:52:39 +0000
>> +++ b/mysql-test/r/mysqld--help-notwin.result	2010-10-12 17:14:48 +0000
>> @@ -31,10 +31,10 @@ The following options may be given as th
>>    file (Solves most 'table full' errors)
>>    --bind-address=name IP address to bind to.
>>    --binlog-cache-size=#
>> - The size of the cache to hold the SQL statements for the
>> - binary log during a transaction. If you often use big,
>> - multi-statement transactions you can increase this to get
>> - more performance
>> + The size of the trx-cache to hold the SQL statements for
>> + the binary log during a transaction. If you often use
>> + big, multi-statement transactions you can increase this
>> + to get more performance
>>    --binlog-direct-non-transactional-updates
>>    Causes updates to non-transactional engines using
>>    statement format to be written directly to binary log.
>> @@ -65,6 +65,11 @@ The following options may be given as th
>>    The maximum size of a row-based binary log event in
>>    bytes. Rows will be grouped into events smaller than this
>>    size if possible. The value has to be a multiple of 256.
>> + --binlog-stmt-cache-size=#
>> + The size of the stmt-cache to hold the SQL statements for
>> + the binary log during a transaction. If you often use
>> + big, multi-statement transactions you can increase this
>> + to get more performance
>>    --bootstrap         Used by mysql installation scripts.
>>    --bulk-insert-buffer-size=#
>>    Size of tree cache used in bulk insert optimisation. Note
>> @@ -277,14 +282,17 @@ The following options may be given as th
>>    --max-allowed-packet=#
>>    Max packet length to send to or receive from the server
>>    --max-binlog-cache-size=#
>> - Can be used to restrict the total size used to cache a
>> - multi-transaction query
>> + Can be used to restrict the total size used to trx-cache
>> + a multi-transaction query
>>    --max-binlog-dump-events=#
>>    Option used by mysql-test for debugging and testing of
>>    replication.
>>    --max-binlog-size=# Binary log will be rotated automatically when the size
>>    exceeds this value. Will also apply to relay logs if
>>    max_relay_log_size is 0
>> + --max-binlog-stmt-cache-size=#
>> + Can be used to restrict the total size used to stmt-cache
>> + a multi-transaction query
>>    --max-connect-errors=#
>>    If there is more than this number of interrupted
>>    connections from a host this host will be blocked from
>> @@ -733,6 +741,7 @@ binlog-cache-size 32768
>>   binlog-direct-non-transactional-updates FALSE
>>   binlog-format STATEMENT
>>   binlog-row-event-max-size 1024
>> +binlog-stmt-cache-size 32768
>>   bulk-insert-buffer-size 8388608
>>   character-set-client-handshake TRUE
>>   character-set-filesystem binary
>> @@ -812,6 +821,7 @@ max-allowed-packet 1048576
>>   max-binlog-cache-size 18446744073709547520
>>   max-binlog-dump-events 0
>>   max-binlog-size 1073741824
>> +max-binlog-stmt-cache-size 18446744073709547520
>>   max-connect-errors 10
>>   max-connections 151
>>   max-delayed-threads 20
>>
>> === modified file 'mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result'
>> --- a/mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result	2010-10-06
> 08:34:49 +0000
>> +++ b/mysql-test/suite/binlog/r/binlog_mixed_cache_stat.result	2010-10-12
> 17:14:48 +0000
>> @@ -4,6 +4,7 @@ create table t2 (a int) engine=myisam;
>>   **** Preparing the enviroment to check commit and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -11,18 +12,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   commit;
>> @@ -32,34 +47,55 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Preparing the enviroment to check abort and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -67,18 +103,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   rollback;
>> @@ -88,9 +138,16 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   rollback;
>> @@ -98,13 +155,20 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>> @@ -113,8 +177,14 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   drop table t1, t2;
>>
>> === modified file 'mysql-test/suite/binlog/r/binlog_row_cache_stat.result'
>> --- a/mysql-test/suite/binlog/r/binlog_row_cache_stat.result	2010-10-06 08:34:49
> +0000
>> +++ b/mysql-test/suite/binlog/r/binlog_row_cache_stat.result	2010-10-12 17:14:48
> +0000
>> @@ -4,6 +4,7 @@ create table t2 (a int) engine=myisam;
>>   **** Preparing the enviroment to check commit and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -11,18 +12,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   commit;
>> @@ -32,34 +47,55 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Preparing the enviroment to check abort and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -67,18 +103,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   rollback;
>> @@ -88,9 +138,16 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   rollback;
>> @@ -98,13 +155,20 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>> @@ -113,8 +177,14 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   drop table t1, t2;
>>
>> === modified file 'mysql-test/suite/binlog/r/binlog_stm_cache_stat.result'
>> --- a/mysql-test/suite/binlog/r/binlog_stm_cache_stat.result	2010-10-06 08:34:49
> +0000
>> +++ b/mysql-test/suite/binlog/r/binlog_stm_cache_stat.result	2010-10-12 17:14:48
> +0000
>> @@ -4,6 +4,7 @@ create table t2 (a int) engine=myisam;
>>   **** Preparing the enviroment to check commit and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -11,18 +12,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   commit;
>> @@ -32,34 +47,55 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>>   commit;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Preparing the enviroment to check abort and its effect on
>>   **** the binlog_cache_use and binlog_cache_disk_use
>>   **** Expected: binlog_cache_use = 0, binlog_cache_disk_use = 0.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   flush status;
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> @@ -67,18 +103,32 @@ Binlog_cache_use	0
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	0
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Now we are going to create transactional changes which are long enough so
>>   **** they will be flushed to disk...
>>   **** Expected: binlog_cache_use = 1, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>>   Binlog_cache_use	1
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Transactional changes which should not be flushed to disk and so should
> not
>>   **** increase binlog_cache_disk_use.
>>   **** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 0, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   rollback;
>> @@ -88,9 +138,16 @@ Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	0
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Non-Transactional changes which should not be flushed to disk and so
> should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 2, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 1, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t2 values( 1 );
>>   rollback;
>> @@ -98,13 +155,20 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	3
>> +Binlog_cache_use	2
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	1
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   **** Mixed changes which should not be flushed to disk and so should not
>>   **** increase binlog_cache_disk_use.
>> -**** Expected: binlog_cache_use = 5, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_cache_use = 3, binlog_cache_disk_use = 1.
>> +**** Expected: binlog_stmt_cache_use = 2, binlog_stmt_cache_disk_use = 0.
>>   begin;
>>   insert into t1 values( 1 );
>>   insert into t2 values( 1 );
>> @@ -113,8 +177,14 @@ Warnings:
>>   Warning	1196	Some non-transactional changed tables couldn't be rolled back
>>   show status like "binlog_cache_use";
>>   Variable_name	Value
>> -Binlog_cache_use	5
>> +Binlog_cache_use	3
>>   show status like "binlog_cache_disk_use";
>>   Variable_name	Value
>>   Binlog_cache_disk_use	1
>> +show status like "binlog_stmt_cache_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_use	2
>> +show status like "binlog_stmt_cache_disk_use";
>> +Variable_name	Value
>> +Binlog_stmt_cache_disk_use	0
>>   drop table t1, t2;
>>
>> === modified file
> 'mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result'
>> --- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2010-06-30
> 15:25:13 +0000
>> +++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2010-10-12
> 17:14:48 +0000
>> @@ -5,6 +5,10 @@ reset slave;
>>   drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
>>   start slave;
>>   call mtr.add_suppression("Unsafe statement written to the binary log using
> statement format since BINLOG_FORMAT = STATEMENT");
>> +SET GLOBAL max_binlog_cache_size = 4096;
>> +SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>>   CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
>>   CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>> @@ -15,13 +19,14 @@ CREATE TABLE t3(a INT PRIMARY KEY, data
>>   Got one of the listed errors
>>   *** Single statement on non-transactional table ***
>>   Got one of the listed errors
>> -SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
>> -START SLAVE SQL_THREAD;
>> +--source include/wait_for_slave_sql_error_and_skip.inc
>> +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
>> +include/start_slave.inc
>>   *** Single statement on both transactional and non-transactional tables. ***
>>   Got one of the listed errors
>> -SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
>> -START SLAVE SQL_THREAD;
>> -source include/diff_master_slave.inc;
>> +--source include/wait_for_slave_sql_error_and_skip.inc
>> +SET GLOBAL SQL_SLAVE_SKIP_COUNTER= 1;
>> +include/start_slave.inc
>>  
> ########################################################################################
>>   #                             2 - BEGIN - IMPLICIT COMMIT by DDL
>>  
> ########################################################################################
>> @@ -119,6 +124,42 @@ BEGIN;
>>   Got one of the listed errors
>>   COMMIT;
>>   source include/diff_master_slave.inc;
>> +########################################################################
>> +#      8 - Bug#55375(Regression Bug) Transaction bigger than
>> +#          max_binlog_cache_size crashes slave
>> +########################################################################
>> +# [ On Slave ]
>> +SET GLOBAL max_binlog_cache_size = 4096;
>> +SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>> +include/stop_slave.inc
>> +include/start_slave.inc
>> +CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_cache_size' bytes of storage.*");
>> +CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_stmt_cache_size' bytes of storage.*");
>> +CALL mtr.add_suppression("Writing one row to the row-based binary log
> failed.*");
>> +TRUNCATE t1;
>> +SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +BEGIN;
>> +Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
>> +COMMIT;
>> +SELECT count(*) FROM t1;
>> +count(*)
>> +0
>> +show binlog events in 'slave-bin.000001' from<binlog_start>;
>> +Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>> +SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +include/stop_slave.inc
>> +include/start_slave.inc
>> +SELECT count(*) FROM t1;
>> +count(*)
>> +128
>>  
> ########################################################################################
>>   #                                        CLEAN
>>  
> ########################################################################################
>>
>> === modified file 'mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result'
>> --- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result	2010-10-09
> 10:18:16 +0000
>> +++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result	2010-10-12
> 17:14:48 +0000
>> @@ -7,6 +7,8 @@ start slave;
>>   call mtr.add_suppression("Unsafe statement written to the binary log using
> statement format since BINLOG_FORMAT = STATEMENT");
>>   SET GLOBAL max_binlog_cache_size = 4096;
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>>   CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
>>   CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>> @@ -130,13 +132,18 @@ source include/diff_master_slave.inc;
>>   # [ On Slave ]
>>   SET GLOBAL max_binlog_cache_size = 4096;
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   include/stop_slave.inc
>>   include/start_slave.inc
>>   CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_cache_size' bytes of storage.*");
>> +CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_stmt_cache_size' bytes of storage.*");
>>   CALL mtr.add_suppression("Writing one row to the row-based binary log
> failed.*");
>>   TRUNCATE t1;
>>   SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>>   SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>>   BEGIN;
>>   Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
>>   COMMIT;
>> @@ -147,6 +154,8 @@ show binlog events in 'slave-bin.000001'
>>   Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>   SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>>   SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>>   include/stop_slave.inc
>>   include/start_slave.inc
>>   SELECT count(*) FROM t1;
>>
>> === modified file 'mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result'
>> --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2010-10-09
> 10:18:16 +0000
>> +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2010-10-12
> 17:14:48 +0000
>> @@ -7,6 +7,8 @@ start slave;
>>   call mtr.add_suppression("Unsafe statement written to the binary log using
> statement format since BINLOG_FORMAT = STATEMENT");
>>   SET GLOBAL max_binlog_cache_size = 4096;
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>>   CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
>>   CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
>> @@ -129,13 +131,18 @@ source include/diff_master_slave.inc;
>>   # [ On Slave ]
>>   SET GLOBAL max_binlog_cache_size = 4096;
>>   SET GLOBAL binlog_cache_size = 4096;
>> +SET GLOBAL max_binlog_stmt_cache_size = 4096;
>> +SET GLOBAL binlog_stmt_cache_size = 4096;
>>   include/stop_slave.inc
>>   include/start_slave.inc
>>   CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_cache_size' bytes of storage.*");
>> +CALL mtr.add_suppression("Multi-statement transaction required more than
> 'max_binlog_stmt_cache_size' bytes of storage.*");
>>   CALL mtr.add_suppression("Writing one row to the row-based binary log
> failed.*");
>>   TRUNCATE t1;
>>   SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>>   SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>>   BEGIN;
>>   Repeat statement 'INSERT INTO t1 VALUES($n, repeat("a", 32))' 128 times
>>   COMMIT;
>> @@ -146,6 +153,8 @@ show binlog events in 'slave-bin.000001'
>>   Log_name	Pos	Event_type	Server_id	End_log_pos	Info
>>   SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE;
>>   SET GLOBAL binlog_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL max_binlog_stmt_cache_size= ORIGINAL_VALUE;
>> +SET GLOBAL binlog_stmt_cache_size= ORIGINAL_VALUE;
>>   include/stop_slave.inc
>>   include/start_slave.inc
>>   SELECT count(*) FROM t1;
>>
>> === removed file
> 'mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt'
>> ---
> a/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt	2009-11-03 19:02:56
> +0000
>> +++
> b/mysql-test/suite/rpl/t/rpl_mixed_binlog_max_cache_size-master.opt	1970-01-01 00:00:00
> +0000
>> @@ -1 +0,0 @@
>> ---binlog_cache_size=4096 --max_binlog_cache_size=7680
>>
>> === added file 'mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc'
>> --- a/mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc	1970-01-01
> 00:00:00 +0000
>> +++ b/mysql-test/suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc	2010-10-12
> 17:14:48 +0000
>> @@ -0,0 +1,154 @@
>> +################ mysql-test\t\binlog_stmt_cache_size_basic.test
> ################
>> +#                                                                             
> #
>> +# Variable Name: binlog_stmt_cache_size                                       
> #
>> +# Scope: GLOBAL                                                               
> #
>> +# Access Type: Dynamic                                                        
> #
>> +# Data Type: Numeric                                                          
> #
>> +# Default Value: 32768                                                        
> #
>> +# Range: 4096 - 4294967295                                                    
> #
>> +#                                                                             
> #
>> +#                                                                             
> #
>> +# Creation Date: 2010-10-12                                                   
> #
>> +# Author: Alfranio Correia                                                    
> #
>> +#                                                                             
> #
>> +# Description: Test Cases of Dynamic System Variable "binlog_stmt_cache_size" 
> #
>> +#              that checks behavior of this variable in the following ways    
> #
>> +#              * Default Value                                                
> #
>> +#              * Valid&  Invalid values                                     
>   #
>> +#              * Scope&  Access method                                      
>   #
>> +#              * Data Integrity                          .                    
> #
>> +#                                                                             
> #
>> +# Reference: http://dev.mysql.com/doc/refman/5.5/en/                          
> #
>> +#         server-system-variables.html#option_mysqld_binlog_stmt_cache_size   
> #
>> +#                                                                             
> #
>>
> +################################################################################
>> +
>> +#################################################################
>> +#          START OF binlog_stmt_cache_size TESTS                #
>> +#################################################################
>> +
>> +#########################################################################
>> +# Saving initial value of binlog_stmt_cache_size in a temporary variable     #
>> +#########################################################################
>> +
>> +SET @start_value = @@global.binlog_stmt_cache_size;
>> +SELECT @start_value;
>> +
>> +--echo '#--------------------FN_DYNVARS_006_01------------------------#'
>> +#########################################################################
>> +#         Display the DEFAULT value of binlog_stmt_cache_size           #
>> +#########################################################################
>> +
>> +SET @@global.binlog_stmt_cache_size = 100;
>> +SET @@global.binlog_stmt_cache_size = DEFAULT;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#---------------------FN_DYNVARS_006_02-------------------------#'
>> +###############################################
>> +#     Verify default value of variable        #
>> +###############################################
>> +
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size = 32768;
>> +
>> +
>> +--echo '#--------------------FN_DYNVARS_006_03------------------------#'
>> +#########################################################################
>> +#    Change the value of binlog_stmt_cache_size to a valid value        #
>> +#########################################################################
>> +
>> +SET @@global.binlog_stmt_cache_size = 4096;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +SET @@global.binlog_stmt_cache_size = 4294967295;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +SET @@global.binlog_stmt_cache_size = 10000;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +SET @@global.binlog_stmt_cache_size = 21221204;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +echo 'Bug: Invalid values are coming in variable on assigning valid values';
>> +
>> +
>> +--echo '#--------------------FN_DYNVARS_006_04-------------------------#'
>> +############################################################################
>> +#     Change the value of binlog_stmt_cache_size to invalid value          #
>> +############################################################################
>> +
>> +SET @@global.binlog_stmt_cache_size = 1024;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.binlog_stmt_cache_size = 10000.01;
>> +SET @@global.binlog_stmt_cache_size = -1024;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +SET @@global.binlog_stmt_cache_size = 42949672950;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +echo 'Bug: Errors are not coming on assigning invalid values to variable';
>> +
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.binlog_stmt_cache_size = ON;
>> +
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.binlog_stmt_cache_size = 'test';
>> +
>> +
>> +--echo '#-------------------FN_DYNVARS_006_05----------------------------#'
>> +############################################################################
>> +#     Test if accessing session binlog_stmt_cache_size gives error         #
>> +############################################################################
>> +
>> +--Error ER_GLOBAL_VARIABLE
>> +SET @@session.binlog_stmt_cache_size = 0;
>> +
>> +
>> +--echo '#----------------------FN_DYNVARS_006_06------------------------#'
>> +##############################################################################
>> +# Check if the value in GLOBAL Tables matches values in variable             #
>> +##############################################################################
>> +
>> +SELECT @@global.binlog_stmt_cache_size = VARIABLE_VALUE FROM
> INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_stmt_cache_size';
>> +
>> +--echo '#---------------------FN_DYNVARS_006_07----------------------#'
>> +###################################################################
>> +#      Check if TRUE and FALSE values can be used on variable     #
>> +###################################################################
>> +
>> +SET @@global.binlog_stmt_cache_size = TRUE;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +SET @@global.binlog_stmt_cache_size = FALSE;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +echo 'Bug: Errors are not coming on assigning TRUE/FALSE to variable';
>> +
>> +--echo '#---------------------FN_DYNVARS_006_08----------------------#'
>> +###############################################################################
>> +#   Check if accessing variable without SCOPE points to same global variable  #
>> +###############################################################################
>> +
>> +SET @@global.binlog_stmt_cache_size = 1;
>> +SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
>> +
>> +--echo '#---------------------FN_DYNVARS_006_09----------------------#'
>> +###########################################################################
>> +# Check if binlog_stmt_cache_size can be accessed with and without @@ sign#
>> +###########################################################################
>> +
>> +--Error ER_GLOBAL_VARIABLE
>> +SET binlog_stmt_cache_size = 1;
>> +--Error ER_PARSE_ERROR
>> +SET global.binlog_stmt_cache_size = 1;
>> +--Error ER_UNKNOWN_TABLE
>> +SELECT global.binlog_stmt_cache_size;
>> +--Error ER_BAD_FIELD_ERROR
>> +SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
>> +
>> +
>> +##############################
>> +#   Restore initial value    #
>> +##############################
>> +
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +
>> +
>> +###########################################################
>> +#         END OF binlog_stmt_cache_size TESTS             #
>> +###########################################################
>>
>> === added file
> 'mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result'
>> ---
> a/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result	1970-01-01 00:00:00
> +0000
>> +++
> b/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_32.result	2010-10-12 17:14:48
> +0000
>> @@ -0,0 +1,108 @@
>> +SET @start_value = @@global.binlog_stmt_cache_size;
>> +SELECT @start_value;
>> +@start_value
>> +32768
>> +'#--------------------FN_DYNVARS_006_01------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 100;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '100'
>> +SET @@global.binlog_stmt_cache_size = DEFAULT;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +32768
>> +'#---------------------FN_DYNVARS_006_02-------------------------#'
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size = 32768;
>> +@@global.binlog_stmt_cache_size = 32768
>> +1
>> +'#--------------------FN_DYNVARS_006_03------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 4096;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 4294967295;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '4294967295'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4294963200
>> +SET @@global.binlog_stmt_cache_size = 10000;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '10000'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +8192
>> +SET @@global.binlog_stmt_cache_size = 21221204;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '21221204'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +21217280
>> +'Bug: Invalid values are coming in variable on assigning valid values'
>> +'#--------------------FN_DYNVARS_006_04-------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1024'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 10000.01;
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +SET @@global.binlog_stmt_cache_size = -1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '-1024'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 42949672950;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '42949672950'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4294963200
>> +'Bug: Errors are not coming on assigning invalid values to variable'
>> +SET @@global.binlog_stmt_cache_size = ON;
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +SET @@global.binlog_stmt_cache_size = 'test';
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +'#-------------------FN_DYNVARS_006_05----------------------------#'
>> +SET @@session.binlog_stmt_cache_size = 0;
>> +ERROR HY000: Variable 'binlog_stmt_cache_size' is a GLOBAL variable and should
> be set with SET GLOBAL
>> +'#----------------------FN_DYNVARS_006_06------------------------#'
>> +SELECT @@global.binlog_stmt_cache_size = VARIABLE_VALUE FROM
> INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_stmt_cache_size';
>> +@@global.binlog_stmt_cache_size = VARIABLE_VALUE
>> +1
>> +'#---------------------FN_DYNVARS_006_07----------------------#'
>> +SET @@global.binlog_stmt_cache_size = TRUE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = FALSE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '0'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +'Bug: Errors are not coming on assigning TRUE/FALSE to variable'
>> +'#---------------------FN_DYNVARS_006_08----------------------#'
>> +SET @@global.binlog_stmt_cache_size = 1;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1'
>> +SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
>> +@@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size
>> +1
>> +'#---------------------FN_DYNVARS_006_09----------------------#'
>> +SET binlog_stmt_cache_size = 1;
>> +ERROR HY000: Variable 'binlog_stmt_cache_size' is a GLOBAL variable and should
> be set with SET GLOBAL
>> +SET global.binlog_stmt_cache_size = 1;
>> +ERROR 42000: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'binlog_stmt_cache_size = 1' at line 1
>> +SELECT global.binlog_stmt_cache_size;
>> +ERROR 42S02: Unknown table 'global' in field list
>> +SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
>> +ERROR 42S22: Unknown column 'binlog_stmt_cache_size' in 'field list'
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +32768
>>
>> === added file
> 'mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result'
>> ---
> a/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result	1970-01-01 00:00:00
> +0000
>> +++
> b/mysql-test/suite/sys_vars/r/binlog_stmt_cache_size_basic_64.result	2010-10-12 17:14:48
> +0000
>> @@ -0,0 +1,108 @@
>> +SET @start_value = @@global.binlog_stmt_cache_size;
>> +SELECT @start_value;
>> +@start_value
>> +32768
>> +'#--------------------FN_DYNVARS_006_01------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 100;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '100'
>> +SET @@global.binlog_stmt_cache_size = DEFAULT;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +32768
>> +'#---------------------FN_DYNVARS_006_02-------------------------#'
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size = 32768;
>> +@@global.binlog_stmt_cache_size = 32768
>> +1
>> +'#--------------------FN_DYNVARS_006_03------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 4096;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 4294967295;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '4294967295'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4294963200
>> +SET @@global.binlog_stmt_cache_size = 10000;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '10000'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +8192
>> +SET @@global.binlog_stmt_cache_size = 21221204;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '21221204'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +21217280
>> +'Bug: Invalid values are coming in variable on assigning valid values'
>> +'#--------------------FN_DYNVARS_006_04-------------------------#'
>> +SET @@global.binlog_stmt_cache_size = 1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1024'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 10000.01;
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +SET @@global.binlog_stmt_cache_size = -1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '-1024'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = 42949672950;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '42949672950'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4294963200
>> +'Bug: Errors are not coming on assigning invalid values to variable'
>> +SET @@global.binlog_stmt_cache_size = ON;
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +SET @@global.binlog_stmt_cache_size = 'test';
>> +ERROR 42000: Incorrect argument type to variable 'binlog_stmt_cache_size'
>> +'#-------------------FN_DYNVARS_006_05----------------------------#'
>> +SET @@session.binlog_stmt_cache_size = 0;
>> +ERROR HY000: Variable 'binlog_stmt_cache_size' is a GLOBAL variable and should
> be set with SET GLOBAL
>> +'#----------------------FN_DYNVARS_006_06------------------------#'
>> +SELECT @@global.binlog_stmt_cache_size = VARIABLE_VALUE FROM
> INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='binlog_stmt_cache_size';
>> +@@global.binlog_stmt_cache_size = VARIABLE_VALUE
>> +1
>> +'#---------------------FN_DYNVARS_006_07----------------------#'
>> +SET @@global.binlog_stmt_cache_size = TRUE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +SET @@global.binlog_stmt_cache_size = FALSE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '0'
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +4096
>> +'Bug: Errors are not coming on assigning TRUE/FALSE to variable'
>> +'#---------------------FN_DYNVARS_006_08----------------------#'
>> +SET @@global.binlog_stmt_cache_size = 1;
>> +Warnings:
>> +Warning	1292	Truncated incorrect binlog_stmt_cache_size value: '1'
>> +SELECT @@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size;
>> +@@binlog_stmt_cache_size = @@global.binlog_stmt_cache_size
>> +1
>> +'#---------------------FN_DYNVARS_006_09----------------------#'
>> +SET binlog_stmt_cache_size = 1;
>> +ERROR HY000: Variable 'binlog_stmt_cache_size' is a GLOBAL variable and should
> be set with SET GLOBAL
>> +SET global.binlog_stmt_cache_size = 1;
>> +ERROR 42000: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'binlog_stmt_cache_size = 1' at line 1
>> +SELECT global.binlog_stmt_cache_size;
>> +ERROR 42S02: Unknown table 'global' in field list
>> +SELECT binlog_stmt_cache_size = @@session.binlog_stmt_cache_size;
>> +ERROR 42S22: Unknown column 'binlog_stmt_cache_size' in 'field list'
>> +SET @@global.binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.binlog_stmt_cache_size;
>> +@@global.binlog_stmt_cache_size
>> +32768
>>
>> === added file
> 'mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result'
>> ---
> a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result	1970-01-01 00:00:00
> +0000
>> +++
> b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result	2010-10-12 17:14:48
> +0000
>> @@ -0,0 +1,152 @@
>> +SET @start_value = @@global.max_binlog_stmt_cache_size;
>> +SELECT @start_value;
>> +@start_value
>> +18446744073709547520
>> +'#--------------------FN_DYNVARS_072_01------------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = 5000;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '5000'
>> +SET @@global.max_binlog_stmt_cache_size = DEFAULT;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +18446744073709547520
>> +'#---------------------FN_DYNVARS_072_02-------------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.max_binlog_stmt_cache_size = 4294967295;
>> +@@global.max_binlog_stmt_cache_size = 4294967295
>> +0
>> +'#--------------------FN_DYNVARS_072_03------------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = 4096;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 4294967295;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '4294967295'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4294963200
>> +SET @@global.max_binlog_stmt_cache_size = 4294967294;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '4294967294'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4294963200
>> +SET @@global.max_binlog_stmt_cache_size = 4097;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '4097'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 65535;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '65535'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +61440
>> +'#--------------------FN_DYNVARS_072_04-------------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = -1;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '-1'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 100000000000;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value:
> '100000000000'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +99999997952
>> +SET @@global.max_binlog_stmt_cache_size = 10000.01;
>> +ERROR 42000: Incorrect argument type to variable 'max_binlog_stmt_cache_size'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +99999997952
>> +SET @@global.max_binlog_stmt_cache_size = -1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '-1024'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 1024;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '1024'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 4294967296;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4294967296
>> +SET @@global.max_binlog_stmt_cache_size = 4095;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '4095'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = ON;
>> +ERROR 42000: Incorrect argument type to variable 'max_binlog_stmt_cache_size'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = 'test';
>> +ERROR 42000: Incorrect argument type to variable 'max_binlog_stmt_cache_size'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +'#-------------------FN_DYNVARS_072_05----------------------------#'
>> +SET @@session.max_binlog_stmt_cache_size = 4096;
>> +ERROR HY000: Variable 'max_binlog_stmt_cache_size' is a GLOBAL variable and
> should be set with SET GLOBAL
>> +SELECT @@session.max_binlog_stmt_cache_size;
>> +ERROR HY000: Variable 'max_binlog_stmt_cache_size' is a GLOBAL variable
>> +'#----------------------FN_DYNVARS_072_06------------------------#'
>> +SELECT @@global.max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
>> +WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
>> +@@global.max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +1
>> +SELECT @@max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +FROM INFORMATION_SCHEMA.SESSION_VARIABLES
>> +WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
>> +@@max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +1
>> +'#---------------------FN_DYNVARS_072_07----------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = TRUE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '1'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +SET @@global.max_binlog_stmt_cache_size = FALSE;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '0'
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +4096
>> +'#---------------------FN_DYNVARS_072_08----------------------#'
>> +SET @@global.max_binlog_stmt_cache_size = 5000;
>> +Warnings:
>> +Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '5000'
>> +SELECT @@max_binlog_stmt_cache_size = @@global.max_binlog_stmt_cache_size;
>> +@@max_binlog_stmt_cache_size = @@global.max_binlog_stmt_cache_size
>> +1
>> +'#---------------------FN_DYNVARS_072_09----------------------#'
>> +SET max_binlog_stmt_cache_size = 6000;
>> +ERROR HY000: Variable 'max_binlog_stmt_cache_size' is a GLOBAL variable and
> should be set with SET GLOBAL
>> +SELECT @@max_binlog_stmt_cache_size;
>> +@@max_binlog_stmt_cache_size
>> +4096
>> +SET local.max_binlog_stmt_cache_size = 7000;
>> +ERROR 42000: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'max_binlog_stmt_cache_size = 7000' at line 1
>> +SELECT local.max_binlog_stmt_cache_size;
>> +ERROR 42S02: Unknown table 'local' in field list
>> +SET global.max_binlog_stmt_cache_size = 8000;
>> +ERROR 42000: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use near
> 'max_binlog_stmt_cache_size = 8000' at line 1
>> +SELECT global.max_binlog_stmt_cache_size;
>> +ERROR 42S02: Unknown table 'global' in field list
>> +SELECT max_binlog_stmt_cache_size = @@session.max_binlog_stmt_cache_size;
>> +ERROR 42S22: Unknown column 'max_binlog_stmt_cache_size' in 'field list'
>> +SET @@global.max_binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +@@global.max_binlog_stmt_cache_size
>> +18446744073709547520
>>
>> === added file
> 'mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test'
>> --- a/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test	1970-01-01
> 00:00:00 +0000
>> +++ b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_32.test	2010-10-12
> 17:14:48 +0000
>> @@ -0,0 +1,7 @@
>>
> +################################################################################
>> +# Wrapper for 32 bit machines                                                 
> #
>>
> +################################################################################
>> +
>> +--source include/have_32bit.inc
>> +--source suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc
>> +
>>
>> === added file
> 'mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test'
>> --- a/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test	1970-01-01
> 00:00:00 +0000
>> +++ b/mysql-test/suite/sys_vars/t/binlog_stmt_cache_size_basic_64.test	2010-10-12
> 17:14:48 +0000
>> @@ -0,0 +1,7 @@
>>
> +################################################################################
>> +# Wrapper for 64 bit machines                                                 
> #
>>
> +################################################################################
>> +
>> +--source include/have_64bit.inc
>> +--source suite/sys_vars/inc/binlog_stmt_cache_size_basic.inc
>> +
>>
>> === added file
> 'mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test'
>> ---
> a/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test	1970-01-01 00:00:00
> +0000
>> +++
> b/mysql-test/suite/sys_vars/t/max_binlog_stmt_cache_size_basic.test	2010-10-12 17:14:48
> +0000
>> @@ -0,0 +1,184 @@
>> +############ mysql-test\t\max_binlog_stmt_cache_size_basic.test ###############
>> +#                                                                             #
>> +# Variable Name: max_binlog_stmt_cache_size                                   #
>> +# Scope: GLOBAL                                                               #
>> +# Access Type: Dynamic                                                        #
>> +# Data Type: numeric                                                          #
>> +# Default Value:4294967295                                                    #
>> +# Range: 4096-4294967295                                                      #
>> +#                                                                             #
>> +#                                                                             #
>> +#                                                                             #
>> +#                                                                             #
>> +#                                                                             #
>> +# Creation Date: 2008-02-07                                                   #
>> +# Author:  Salman                                                             #
>> +#                                                                             #
>> +# Description: Test Cases of Dynamic System Variable                          #
>> +#              max_binlog_stmt_cache_size that checks                         #
>> +#              the behavior of this variable in the following ways            #
>> +#              * Default Value                                                #
>> +#              * Valid&  Invalid values                                     
>  #
>> +#              * Scope&  Access method                                      
>  #
>> +#              * Data Integrity                                               #
>> +#                                                                             #
>> +# Reference: http://dev.mysql.com/doc/refman/5.5/en/                          #
>> +#  server-system-variables.html                                               #
>> +#                                                                             #
>> +###############################################################################
>> +
>> +--source include/load_sysvars.inc
>> +
>> +##########################################################################
>> +#           START OF max_binlog_stmt_cache_size TESTS                    #
>> +##########################################################################
>> +
>> +
>> +##############################################################################
>> +# Saving initial value of max_binlog_stmt_cache_size in a temporary variable #
>> +##############################################################################
>> +
>> +SET @start_value = @@global.max_binlog_stmt_cache_size;
>> +SELECT @start_value;
>> +
>> +
>> +--echo '#--------------------FN_DYNVARS_072_01------------------------#'
>> +########################################################################
>> +#       Display the DEFAULT value of max_binlog_stmt_cache_size        #
>> +########################################################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = 5000;
>> +SET @@global.max_binlog_stmt_cache_size = DEFAULT;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
>> +###############################################
>> +#     Verify default value of variable        #
>> +###############################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.max_binlog_stmt_cache_size = 4294967295;
>> +
>> +--echo '#--------------------FN_DYNVARS_072_03------------------------#'
>> +########################################################################
>> +#   Change the value of max_binlog_stmt_cache_size to a valid value    #
>> +########################################################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = 4096;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 4294967295;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 4294967294;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 4097;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 65535;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
>> +###########################################################################
>> +#     Change the value of max_binlog_stmt_cache_size to invalid value     #
>> +###########################################################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = -1;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 100000000000;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.max_binlog_stmt_cache_size = 10000.01;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = -1024;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 1024;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 4294967296;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = 4095;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.max_binlog_stmt_cache_size = ON;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +--Error ER_WRONG_TYPE_FOR_VAR
>> +SET @@global.max_binlog_stmt_cache_size = 'test';
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
>> +###########################################################################
>> +#    Test if accessing session max_binlog_stmt_cache_size gives error     #
>> +###########################################################################
>> +
>> +--Error ER_GLOBAL_VARIABLE
>> +SET @@session.max_binlog_stmt_cache_size = 4096;
>> +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
>> +SELECT @@session.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#----------------------FN_DYNVARS_072_06------------------------#'
>> +##############################################################################
>> +# Check if the value in GLOBAL&  SESSION Tables matches values in variable  
> #
>> +##############################################################################
>> +
>> +SELECT @@global.max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
>> +WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
>> +
>> +SELECT @@max_binlog_stmt_cache_size = VARIABLE_VALUE
>> +FROM INFORMATION_SCHEMA.SESSION_VARIABLES
>> +WHERE VARIABLE_NAME='max_binlog_stmt_cache_size';
>> +
>> +
>> +--echo '#---------------------FN_DYNVARS_072_07----------------------#'
>> +###################################################################
>> +#      Check if TRUE and FALSE values can be used on variable     #
>> +###################################################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = TRUE;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +SET @@global.max_binlog_stmt_cache_size = FALSE;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#---------------------FN_DYNVARS_072_08----------------------#'
>>
> +########################################################################################################
>> +#   Check if accessing variable with SESSION,LOCAL and without SCOPE points to
> same session variable   #
>>
> +########################################################################################################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = 5000;
>> +SELECT @@max_binlog_stmt_cache_size = @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +--echo '#---------------------FN_DYNVARS_072_09----------------------#'
>>
> +################################################################################
>> +# Check if max_binlog_stmt_cache_size can be accessed with and without @@ sign
> #
>>
> +################################################################################
>> +
>> +--Error ER_GLOBAL_VARIABLE
>> +SET max_binlog_stmt_cache_size = 6000;
>> +SELECT @@max_binlog_stmt_cache_size;
>> +--Error ER_PARSE_ERROR
>> +SET local.max_binlog_stmt_cache_size = 7000;
>> +--Error ER_UNKNOWN_TABLE
>> +SELECT local.max_binlog_stmt_cache_size;
>> +--Error ER_PARSE_ERROR
>> +SET global.max_binlog_stmt_cache_size = 8000;
>> +--Error ER_UNKNOWN_TABLE
>> +SELECT global.max_binlog_stmt_cache_size;
>> +--Error ER_BAD_FIELD_ERROR
>> +SELECT max_binlog_stmt_cache_size = @@session.max_binlog_stmt_cache_size;
>> +
>> +
>> +##############################
>> +#   Restore initial value    #
>> +##############################
>> +
>> +SET @@global.max_binlog_stmt_cache_size = @start_value;
>> +SELECT @@global.max_binlog_stmt_cache_size;
>> +
>> +
>> +########################################################################
>> +#           END OF max_binlog_stmt_cache_size TESTS                    #
>> +########################################################################
>>
>> === modified file 'sql/log.cc'
>> --- a/sql/log.cc	2010-10-11 17:12:02 +0000
>> +++ b/sql/log.cc	2010-10-12 17:14:48 +0000
>> @@ -213,9 +213,7 @@ public:
>>   #ifndef DBUG_OFF
>>     , has_trans(FALSE)
>>   #endif
>> -  {
>> -    cache_log.end_of_file= max_binlog_cache_size;
>> -  }
>> +  { }
>>
>>     ~binlog_cache_data()
>>     {
>> @@ -258,13 +256,19 @@ public:
>>       return (changes_to_non_trans_temp_table_flag);
>>     }
>>
>> +  void set_max_binlog_cache_size(ulong param_max_binlog_cache_size)
>> +  {
>> +    saved_max_binlog_cache_size= param_max_binlog_cache_size;
>> +    cache_log.end_of_file= saved_max_binlog_cache_size;
>> +  }
>> +
>>     void reset()
>>     {
>>       truncate(0);
>>       changes_to_non_trans_temp_table_flag= FALSE;
>>       incident= FALSE;
>>       before_stmt_pos= MY_OFF_T_UNDEF;
>> -    cache_log.end_of_file= max_binlog_cache_size;
>> +    cache_log.end_of_file= saved_max_binlog_cache_size;
>>       /*
>>         When a truncate is called there may be write activity and by consequence
>>         "disk_writes" is increased. This breaks the "disk_writes"' use by the
>> @@ -352,6 +356,11 @@ private:
>>   #endif
>>
>>     /*
>> +    Stores the max_binlog_cache_size defined when the cache is created.
>> +  */
>
> Logically, it is at creation time. But for some reason that could change (we're
> not setting it in the object constructor anymore, but through set member function).
>
>> +  ulong saved_max_binlog_cache_size;
>> +
>> +  /*
>>       It truncates the cache to a certain position. This includes deleting the
>>       pending event.
>>      */
>> @@ -1542,13 +1551,14 @@ static int binlog_close_connection(handl
>>                        stored.
>>   */
>>   static inline void
>> -binlog_compute_statistics(binlog_cache_data* cache_data)
>> +binlog_compute_statistics(binlog_cache_data* cache_data,
>> +                          ulong *binlog_use, ulong *binlog_disk_use)
>>   {
>>     if (!cache_data->empty())
>>     {
>> -    statistic_increment(binlog_cache_use,&LOCK_status);
>> +    statistic_increment(*binlog_use,&LOCK_status);
>>       if (cache_data->cache_log.disk_writes != 0)
>> -      statistic_increment(binlog_cache_disk_use,&LOCK_status);
>> +      statistic_increment(*binlog_disk_use,&LOCK_status);
>>     }
>>   }
>>
>> @@ -1595,7 +1605,11 @@ binlog_flush_cache(THD *thd, binlog_cach
>>       error= mysql_bin_log.write(thd,&cache_data->cache_log, end_evt,
>>                                  cache_data->has_incident());
>>     }
>> -  binlog_compute_statistics(cache_data);
>> +  binlog_compute_statistics(cache_data,
>> +                            is_transactional ?&binlog_cache_use :
>> +&binlog_stmt_cache_use,
>> +                            is_transactional ?&binlog_cache_disk_use :
>> +&binlog_stmt_cache_disk_use);
>>     cache_data->reset();
>>
>>     DBUG_ASSERT(cache_data->empty());
>> @@ -1716,8 +1730,8 @@ binlog_truncate_trx_cache(THD *thd, binl
>>
>>       thd->clear_binlog_table_maps();
>>
>> -    binlog_compute_statistics(&cache_mngr->trx_cache);
>> -
>> +   
> binlog_compute_statistics(&cache_mngr->trx_cache,&binlog_cache_use,
>> +&binlog_cache_disk_use);
>>       cache_mngr->reset_cache(&cache_mngr->trx_cache);
>>     }
>>     /*
>> @@ -1886,7 +1900,7 @@ static int binlog_rollback(handlerton *h
>>     DBUG_RETURN(error);
>>   }
>>
>> -void MYSQL_BIN_LOG::set_write_error(THD *thd)
>> +void MYSQL_BIN_LOG::set_write_error(THD *thd, bool is_transactional)
>>   {
>>     DBUG_ENTER("MYSQL_BIN_LOG::set_write_error");
>>
>> @@ -1896,9 +1910,20 @@ void MYSQL_BIN_LOG::set_write_error(THD
>>       DBUG_VOID_RETURN;
>>
>>     if (my_errno == EFBIG)
>> -    my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(MY_WME));
>> +  {
>> +    if (is_transactional)
>> +    {
>> +      my_message(ER_TRANS_CACHE_FULL, ER(ER_TRANS_CACHE_FULL), MYF(MY_WME));
>> +    }
>> +    else
>> +    {
>> +      my_message(ER_STMT_CACHE_FULL, ER(ER_STMT_CACHE_FULL), MYF(MY_WME));
>> +    }
>> +  }
>>     else
>> +  {
>>       my_error(ER_ERROR_ON_WRITE, MYF(MY_WME), name, errno);
>> +  }
>>
>>     DBUG_VOID_RETURN;
>>   }
>> @@ -1915,6 +1940,7 @@ bool MYSQL_BIN_LOG::check_write_error(TH
>>     switch (thd->stmt_da->sql_errno())
>>     {
>>       case ER_TRANS_CACHE_FULL:
>> +    case ER_STMT_CACHE_FULL:
>>       case ER_ERROR_ON_WRITE:
>>       case ER_BINLOG_LOGGING_IMPOSSIBLE:
>>         checked= TRUE;
>> @@ -4417,6 +4443,8 @@ int THD::binlog_setup_trx_data()
>>     thd_set_ha_data(this, binlog_hton, cache_mngr);
>>
>>     cache_mngr= new (thd_get_ha_data(this, binlog_hton)) binlog_cache_mngr;
>> + 
> cache_mngr->stmt_cache.set_max_binlog_cache_size(max_binlog_stmt_cache_size);
>> +  cache_mngr->trx_cache.set_max_binlog_cache_size(max_binlog_cache_size);
>
> Technically, this setting is not at creation time (although logically it is).
> If for some reason these sets are moved the comment in the
> max_binlog_[stmt_]cache_size declaration becomes incorrect. But I guess we
> can keep it for now, or just change the comment text a little...
>
>>
>>   #ifndef DBUG_OFF
>>     cache_mngr->trx_cache.set_transactional(TRUE);
>> @@ -4674,7 +4702,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_row
>>       */
>>       if (pending->write(file))
>>       {
>> -      set_write_error(thd);
>> +      set_write_error(thd, is_transactional);
>>         if (check_write_error(thd)&&  cache_data&&
>>             stmt_has_updated_non_trans_table(thd))
>>           cache_data->set_incident();
>> @@ -4699,6 +4727,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
>>     bool error= 1;
>>     DBUG_ENTER("MYSQL_BIN_LOG::write(Log_event *)");
>>     binlog_cache_data *cache_data= 0;
>> +  bool is_trans_cache= FALSE;
>>
>>     if (thd->binlog_evt_union.do_union)
>>     {
>> @@ -4759,7 +4788,7 @@ bool MYSQL_BIN_LOG::write(Log_event *eve
>>         binlog_cache_mngr *const cache_mngr=
>>           (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
>>
>> -      bool is_trans_cache= use_trans_cache(thd,
> event_info->use_trans_cache());
>> +      is_trans_cache= use_trans_cache(thd, event_info->use_trans_cache());
>>         file= cache_mngr->get_binlog_cache_log(is_trans_cache);
>>         cache_data= cache_mngr->get_binlog_cache_data(is_trans_cache);
>>
>> @@ -4865,7 +4894,7 @@ unlock:
>>
>>       if (error)
>>       {
>> -      set_write_error(thd);
>> +      set_write_error(thd, is_trans_cache);
>>         if (check_write_error(thd)&&  cache_data&&
>>             stmt_has_updated_non_trans_table(thd))
>>           cache_data->set_incident();
>>
>> === modified file 'sql/log.h'
>> --- a/sql/log.h	2010-09-29 14:26:32 +0000
>> +++ b/sql/log.h	2010-10-12 17:14:48 +0000
>> @@ -399,7 +399,7 @@ public:
>>     bool write_incident(THD *thd, bool lock);
>>
>>     int  write_cache(IO_CACHE *cache, bool lock_log, bool flush_and_sync);
>> -  void set_write_error(THD *thd);
>> +  void set_write_error(THD *thd, bool is_transactional);
>>     bool check_write_error(THD *thd);
>>
>>     void start_union_events(THD *thd, query_id_t query_id_param);
>>
>> === modified file 'sql/mysqld.cc'
>> --- a/sql/mysqld.cc	2010-10-08 14:52:39 +0000
>> +++ b/sql/mysqld.cc	2010-10-12 17:14:48 +0000
>> @@ -460,6 +460,8 @@ ulonglong slave_type_conversions_options
>>   ulong thread_cache_size=0;
>>   ulong binlog_cache_size=0;
>>   ulonglong  max_binlog_cache_size=0;
>> +ulong binlog_stmt_cache_size=0;
>> +ulonglong  max_binlog_stmt_cache_size=0;
>>   ulong query_cache_size=0;
>>   ulong refresh_version;  /* Increments on each reload */
>>   query_id_t global_query_id;
>> @@ -471,6 +473,7 @@ ulong delayed_insert_threads, delayed_in
>>   ulong delayed_insert_errors,flush_time;
>>   ulong specialflag=0;
>>   ulong binlog_cache_use= 0, binlog_cache_disk_use= 0;
>> +ulong binlog_stmt_cache_use= 0, binlog_stmt_cache_disk_use= 0;
>>   ulong max_connections, max_connect_errors;
>>   /**
>>     Limit of the total number of prepared statements in the server.
>> @@ -6406,6 +6409,8 @@ SHOW_VAR status_vars[]= {
>>     {"Aborted_connects",         (char*)&aborted_connects,       SHOW_LONG},
>>     {"Binlog_cache_disk_use",    (char*)&binlog_cache_disk_use,  SHOW_LONG},
>>     {"Binlog_cache_use",         (char*)&binlog_cache_use,       SHOW_LONG},
>> +  {"Binlog_stmt_cache_disk_use",(char*)&binlog_stmt_cache_disk_use, 
> SHOW_LONG},
>> +  {"Binlog_stmt_cache_use",    (char*)&binlog_stmt_cache_use,      
> SHOW_LONG},
>>     {"Bytes_received",           (char*) offsetof(STATUS_VAR, bytes_received),
> SHOW_LONGLONG_STATUS},
>>     {"Bytes_sent",               (char*) offsetof(STATUS_VAR, bytes_sent),
> SHOW_LONGLONG_STATUS},
>>     {"Com",                      (char*) com_status_vars, SHOW_ARRAY},
>>
>> === modified file 'sql/mysqld.h'
>> --- a/sql/mysqld.h	2010-08-30 14:07:40 +0000
>> +++ b/sql/mysqld.h	2010-10-12 17:14:48 +0000
>> @@ -152,6 +152,7 @@ extern ulonglong keybuff_size;
>>   extern ulonglong thd_startup_options;
>>   extern ulong thread_id;
>>   extern ulong binlog_cache_use, binlog_cache_disk_use;
>> +extern ulong binlog_stmt_cache_use, binlog_stmt_cache_disk_use;
>>   extern ulong aborted_threads,aborted_connects;
>>   extern ulong delayed_insert_timeout;
>>   extern ulong delayed_insert_limit, delayed_queue_size;
>> @@ -171,8 +172,9 @@ extern uint  slave_net_timeout;
>>   extern uint max_user_connections;
>>   extern ulong what_to_log,flush_time;
>>   extern ulong max_prepared_stmt_count, prepared_stmt_count;
>> -extern ulong binlog_cache_size, open_files_limit;
>> -extern ulonglong max_binlog_cache_size;
>> +extern ulong open_files_limit;
>> +extern ulong binlog_cache_size, binlog_stmt_cache_size;
>> +extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
>>   extern ulong max_binlog_size, max_relay_log_size;
>>   extern ulong opt_binlog_rows_event_max_size;
>>   extern ulong rpl_recovery_rank, thread_cache_size;
>>
>> === modified file 'sql/share/errmsg-utf8.txt'
>> --- a/sql/share/errmsg-utf8.txt	2010-10-07 23:34:59 +0000
>> +++ b/sql/share/errmsg-utf8.txt	2010-10-12 17:14:48 +0000
>> @@ -6392,3 +6392,16 @@ ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MI
>>   ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX
>>     eng "The requested value for the heartbeat period exceeds the value of
> `slave_net_timeout' seconds. A sensible value for the period should be less than the
> timeout."
>>
>> +ER_STMT_CACHE_FULL
>> +        dan "Fler-udtryks transaktion krævede mere plads en
> 'max_binlog_stmt_cache_size' bytes. Forhøj værdien af denne variabel og
> prøv igen"
>> +        nla "Multi-statement transactie vereist meer dan
> 'max_binlog_stmt_cache_size' bytes opslag. Verhoog deze mysqld variabele en probeer
> opnieuw"
>> +        eng "Multi-statement transaction required more than
> 'max_binlog_stmt_cache_size' bytes of storage; increase this mysqld variable and try
> again"
>> +        est "Mitme lausendiga transaktsioon nõudis rohkem ruumi kui
> lubatud 'max_binlog_stmt_cache_size' muutujaga. Suurenda muutuja väärtust ja
> proovi uuesti"
>> +        fre "Cette transaction à commandes multiples nécessite
> plus de 'max_binlog_stmt_cache_size' octets de stockage, augmentez cette variable de
> mysqld et réessayez"
>> +        ger "Transaktionen, die aus mehreren Befehlen bestehen, benötigten
> mehr als 'max_binlog_stmt_cache_size' Bytes an Speicher. Btte vergrössern Sie diese
> Server-Variable versuchen Sie es noch einmal"
>> +        ita "La transazione a comandi multipli (multi-statement) ha richiesto
> piu` di 'max_binlog_stmt_cache_size' bytes di disco: aumentare questa variabile di mysqld
> e riprovare"
>> +        por "Transações multi-declaradas (multi-statement
> transactions) requeriram mais do que o valor limite (max_binlog_stmt_cache_size) de bytes
> para armazenagem. Aumente o valor desta variável do mysqld e tente novamente"
>> +        rus "Транзакции, включающей большое
> количество команд, потребовалось более чем
> 'max_binlog_stmt_cache_size' байт. Увеличьте эту переменную
> сервера mysqld и попробуйте еще раз"
>> +        spa "Multipla transición necesita mas que
> 'max_binlog_stmt_cache_size' bytes de almacenamiento. Aumente esta variable mysqld y tente
> de nuevo"
>> +        swe "Transaktionen krävde mera än 'max_binlog_stmt_cache_size'
> minne. Öka denna mysqld-variabel och försök på nytt"
>> +        ukr "Транзакція з багатьма виразами
> вимагає більше ніж 'max_binlog_stmt_cache_size' байтів для
> зберігання. Збільште цю змінну mysqld та спробуйте
> знову"
>
>
> I think there is a typo in the ukr message ;). Just kidding.
> I can't really tell if there is anthing wrong with the translation,
> so I go with what you've written.
>
>>
>> === modified file 'sql/sys_vars.cc'
>> --- a/sql/sys_vars.cc	2010-10-08 12:22:22 +0000
>> +++ b/sql/sys_vars.cc	2010-10-12 17:14:48 +0000
>> @@ -236,7 +236,7 @@ static Sys_var_charptr Sys_basedir(
>>          IN_FS_CHARSET, DEFAULT(0));
>>
>>   static Sys_var_ulong Sys_binlog_cache_size(
>> -       "binlog_cache_size", "The size of the cache to "
>> +       "binlog_cache_size", "The size of the trx-cache to "
>
> Suggestion:
>
> "The size of the transactional cache " ?
>
>>          "hold the SQL statements for the binary log during a"
>>          "transaction. If you often use big, multi-statement "
>>          "transactions you can increase this to get more performance",
>
> Suggestion (or something alike):
>
>    "transactions you can increase this to tune performance." ?
>
>
>> @@ -244,6 +244,15 @@ static Sys_var_ulong Sys_binlog_cache_si
>>          CMD_LINE(REQUIRED_ARG),
>>          VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
>>
>> +static Sys_var_ulong Sys_binlog_stmt_cache_size(
>> +       "binlog_stmt_cache_size", "The size of the stmt-cache to "
>
> Suggestion:
>
> "The size of the statement cache to " ?
>
>> +       "hold the SQL statements for the binary log during a "
>> +       "transaction. If you often use big, multi-statement "
>> +       "transactions you can increase this to get more performance",
>
> Suggestion (or something alike):
>
>    "transactions you can increase this to tune performance." ?
>
>> +       GLOBAL_VAR(binlog_stmt_cache_size),
>> +       CMD_LINE(REQUIRED_ARG),
>> +       VALID_RANGE(IO_SIZE, ULONG_MAX), DEFAULT(32768), BLOCK_SIZE(IO_SIZE));
>> +
>>   static bool check_has_super(sys_var *self, THD *thd, set_var *var)
>>   {
>>     DBUG_ASSERT(self->scope() != sys_var::GLOBAL);// don't abuse
> check_has_super()
>> @@ -1031,13 +1040,22 @@ static Sys_var_ulong Sys_max_allowed_pac
>>
>>   static Sys_var_ulonglong Sys_max_binlog_cache_size(
>>          "max_binlog_cache_size",
>> -       "Can be used to restrict the total size used to cache a "
>> +       "Can be used to restrict the total size used to trx-cache a "
>
> "Can be used to restrict the total size used to cache (in transactional
> cache) a multi-transaction query." ?
>
>
>>          "multi-transaction query",
>>          GLOBAL_VAR(max_binlog_cache_size), CMD_LINE(REQUIRED_ARG),
>>          VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
>>          DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
>>          BLOCK_SIZE(IO_SIZE));
>>
>> +static Sys_var_ulonglong Sys_max_binlog_stmt_cache_size(
>> +       "max_binlog_stmt_cache_size",
>> +       "Can be used to restrict the total size used to stmt-cache a "
>> +       "multi-transaction query",
>
> This is a bit unclear ^. Can we have a better wording for this?
>
> "Can be used to restrict the total size used to cache (in statement
> cache) a multi-transaction query." ?
>
>> +       GLOBAL_VAR(max_binlog_stmt_cache_size), CMD_LINE(REQUIRED_ARG),
>> +       VALID_RANGE(IO_SIZE, ULONGLONG_MAX),
>> +       DEFAULT((ULONGLONG_MAX/IO_SIZE)*IO_SIZE),
>> +       BLOCK_SIZE(IO_SIZE));
>> +
>>   static bool fix_max_binlog_size(sys_var *self, THD *thd, enum_var_type type)
>>   {
>>     mysql_bin_log.set_max_size(max_binlog_size);
>>
>>
>>
>>
>>
>

Thread
bzr commit into mysql-5.5-bugteam branch (alfranio.correia:3231) Bug#57275Alfranio Correia12 Oct
  • Re: bzr commit into mysql-5.5-bugteam branch (alfranio.correia:3231)Bug#57275Luís Soares22 Oct
    • Re: bzr commit into mysql-5.5-bugteam branch (alfranio.correia:3231)Bug#57275Alfranio Correia22 Oct