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 26source include/master-slave.inc; 27 28create temporary table t1 (n int); 29insert into t1 values(1); 30sync_slave_with_master; 31show status like 'Slave_open_temp_tables'; 32 33# Perform a delete from temp table 34connection master; 35delete from t1; 36sync_slave_with_master; 37show status like 'Slave_open_temp_tables'; 38 39# Perform truncate on temp table 40connection master; 41truncate t1; 42sync_slave_with_master; 43show status like 'Slave_open_temp_tables'; 44 45# Disconnect the master, temp table on slave should disappear 46disconnect master; 47 48connection slave; 49 50# Wait until drop of temp tables appers in slave's binlog 51let $wait_binlog_event= DROP; 52source include/wait_for_binlog_event.inc; 53 54show status like 'Slave_open_temp_tables'; 55 56 57--source include/rpl_end.inc 58