1include/master-slave.inc
2[connection master]
3call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t2 set data=repeat.*'a', @act_size.*");
4call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Statement: insert into t1 values.* NAME_CONST.*'n',.*, @data .*");
5set @save_binlog_cache_size = @@global.binlog_cache_size;
6set @save_binlog_checksum = @@global.binlog_checksum;
7set @save_master_verify_checksum = @@global.master_verify_checksum;
8set @@global.binlog_cache_size = 4096;
9set @@global.binlog_checksum = CRC32;
10set @@global.master_verify_checksum = 1;
11include/stop_slave.inc
12include/start_slave.inc
13flush status;
14show status like "binlog_cache_use";
15Variable_name	Value
16Binlog_cache_use	0
17show status like "binlog_cache_disk_use";
18Variable_name	Value
19Binlog_cache_disk_use	0
20drop table if exists t1;
21create table t1 (a int PRIMARY KEY, b CHAR(32)) engine=innodb;
22create procedure test.p_init (n int, size int)
23begin
24while n > 0 do
25select round(RAND() * size) into @act_size;
26set @data = repeat('a', @act_size);
27insert into t1 values(n, @data );
28set n= n-1;
29end while;
30end|
31begin;
32call test.p_init(4000, 32);
33commit;
34show status like "binlog_cache_use";
35Variable_name	Value
36Binlog_cache_use	1
37*** binlog_cache_disk_use must be non-zero ***
38show status like "binlog_cache_disk_use";
39Variable_name	Value
40Binlog_cache_disk_use	1
41include/diff_tables.inc [master:test.t1, slave:test.t1]
42begin;
43delete from t1;
44commit;
45flush status;
46create table t2(a int auto_increment primary key, data VARCHAR(12288)) ENGINE=Innodb;
47show status like "binlog_cache_use";
48Variable_name	Value
49Binlog_cache_use	1
50*** binlog_cache_disk_use must be non-zero ***
51show status like "binlog_cache_disk_use";
52Variable_name	Value
53Binlog_cache_disk_use	1
54include/diff_tables.inc [master:test.t2, slave:test.t2]
55begin;
56delete from t2;
57commit;
58flush status;
59create table t3(a int auto_increment primary key, data VARCHAR(8192)) engine=innodb;
60show status like "binlog_cache_use";
61Variable_name	Value
62Binlog_cache_use	1
63*** binlog_cache_disk_use must be non-zero ***
64show status like "binlog_cache_disk_use";
65Variable_name	Value
66Binlog_cache_disk_use	1
67include/diff_tables.inc [master:test.t3, slave:test.t3]
68begin;
69delete from t3;
70commit;
71flush status;
72create procedure test.p1 (n int)
73begin
74while n > 0 do
75case (select (round(rand()*100) % 3) + 1)
76when 1 then
77select round(RAND() * 32) into @act_size;
78set @data = repeat('a', @act_size);
79insert into t1 values(n, @data);
80when 2 then
81begin
82select round(8192 + RAND() * 4096) into @act_size;
83insert into t2 set data=repeat('a', @act_size);
84end;
85when 3 then
86begin
87select round(3686.4000 + RAND() * 819.2000) into @act_size;
88insert into t3 set data= repeat('a', @act_size);
89end;
90end case;
91set n= n-1;
92end while;
93end|
94set autocommit= 0;
95begin;
96call test.p1(1000);
97commit;
98show status like "binlog_cache_use";
99Variable_name	Value
100Binlog_cache_use	1
101*** binlog_cache_disk_use must be non-zero ***
102show status like "binlog_cache_disk_use";
103Variable_name	Value
104Binlog_cache_disk_use	1
105include/diff_tables.inc [master:test.t1, slave:test.t1]
106include/diff_tables.inc [master:test.t2, slave:test.t2]
107include/diff_tables.inc [master:test.t3, slave:test.t3]
108begin;
109delete from t1;
110delete from t2;
111delete from t3;
112commit;
113drop table t1, t2, t3;
114set @@global.binlog_cache_size = @save_binlog_cache_size;
115set @@global.binlog_checksum = @save_binlog_checksum;
116set @@global.master_verify_checksum = @save_master_verify_checksum;
117drop procedure test.p_init;
118drop procedure test.p1;
119include/rpl_end.inc
120