1#############################################################
2#  Bug#23533: CREATE SELECT max_binlog_cache_size test
3#  case needed
4#############################################################
5
6--source include/have_innodb.inc
7--source include/have_log_bin.inc
8--source include/have_binlog_format_row.inc
9--source include/not_gtid_enabled.inc
10
11SET AUTOCOMMIT=0;
12
13# Create 1st table
14CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b TEXT, PRIMARY KEY(a)) ENGINE=InnoDB;
15--disable_query_log
16let $i= 1000;
17while ($i)
18{
19  BEGIN;
20  eval INSERT INTO t1 VALUES($i, REPEAT('x', 4096));
21  COMMIT;
22  dec $i;
23}
24--enable_query_log
25SELECT COUNT(*) FROM t1;
26
27# Set small value for max_binlog_cache_size
28let $saved_binlog_cache_size= query_get_value(SELECT @@binlog_cache_size AS Value, Value, 1);
29let $saved_max_binlog_cache_size= query_get_value(SELECT @@max_binlog_cache_size AS Value, Value, 1);
30SET GLOBAL binlog_cache_size=4096;
31SET GLOBAL max_binlog_cache_size=4096;
32
33# New value of max_binlog_cache_size will apply to new session
34disconnect default;
35connect(default,localhost,root,,test);
36
37# Copied data from t1 into t2 large than max_binlog_cache_size
38START TRANSACTION;
39--error ER_TRANS_CACHE_FULL
40CREATE TABLE t2 SELECT * FROM t1;
41COMMIT;
42SHOW TABLES LIKE 't%';
43
44# 5.1 End of Test
45--disable_query_log
46eval SET GLOBAL max_binlog_cache_size=$saved_max_binlog_cache_size;
47eval SET GLOBAL binlog_cache_size=$saved_binlog_cache_size;
48--enable_query_log
49DROP TABLE t1;
50disconnect default;
51connect(default,localhost,root,,test);
52