Debian Codegraph @

mysql-test/suite/rpl/t/rpl_trunc_temp.test

raw
1 # ==== Purpose ====
2 #
3 # Verify that Slave_open_temp_tables is increased when a temporary
4 # table is opened on the slave, and decreased when a temporary table
5 # is closed on the slave, and that it is preserved during 'DELETE FROM
6 # table' and 'TRUNCATE table'.
7 #
8 # ==== Method ====
9 #
10 # Create a temporary table on master, insert rows, and try:
11 # - delete rows from the table
12 # - truncate the table
13 # - drop the table
14 #
15 # ==== Related bugs ====
16 #
17 # BUG#17137 Running "truncate table" on temporary table leaves the table open on a slave
18 #
19 # Bug in this test: BUG#37493: rpl_trunc_temp.test nondeterministic
20
21
22 # Requires statement-based logging since temporary tables are not
23 # logged in row-based logging
24 -- source include/have_binlog_format_mixed_or_statement.inc
25
26 source include/master-slave.inc;
27
28 create temporary table t1 (n int);
29 insert into t1 values(1);
30 sync_slave_with_master;
31 show status like 'Slave_open_temp_tables';
32
33 # Perform a delete from temp table
34 connection master;
35 delete from t1;
36 sync_slave_with_master;
37 show status like 'Slave_open_temp_tables';
38
39 # Perform truncate on temp table
40 connection master;
41 truncate t1;
42 sync_slave_with_master;
43 show status like 'Slave_open_temp_tables';
44
45 # Disconnect the master, temp table on slave should disappear
46 disconnect master;
47
48 connection slave;
49
50 # Wait until drop of temp tables appers in slave's binlog
51 let $wait_binlog_event= DROP;
52 source include/wait_for_binlog_event.inc;
53
54 show status like 'Slave_open_temp_tables';
55
56
57 --source include/rpl_end.inc