| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify that Replica_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. Same now goes for mixed, valid for statement |
| 24 |
# only replication as a result of 72475 |
| 25 |
-- source include/have_binlog_format_statement.inc |
| 26 |
|
| 27 |
source include/master-slave.inc; |
| 28 |
|
| 29 |
create temporary table t1 (n int); |
| 30 |
insert into t1 values(1); |
| 31 |
--source include/sync_slave_sql_with_master.inc |
| 32 |
show status like 'Replica_open_temp_tables'; |
| 33 |
|
| 34 |
# Perform a delete from temp table |
| 35 |
connection master; |
| 36 |
delete from t1; |
| 37 |
--source include/sync_slave_sql_with_master.inc |
| 38 |
show status like 'Replica_open_temp_tables'; |
| 39 |
|
| 40 |
# Perform truncate on temp table |
| 41 |
connection master; |
| 42 |
truncate t1; |
| 43 |
--source include/sync_slave_sql_with_master.inc |
| 44 |
show status like 'Replica_open_temp_tables'; |
| 45 |
|
| 46 |
# Disconnect the master, temp table on slave should dissapear |
| 47 |
disconnect master; |
| 48 |
|
| 49 |
connection slave; |
| 50 |
|
| 51 |
# Wait until drop of temp tables appers in slave's binlog |
| 52 |
let $wait_binlog_event= DROP; |
| 53 |
source include/wait_for_binlog_event.inc; |
| 54 |
|
| 55 |
show status like 'Replica_open_temp_tables'; |
| 56 |
|
| 57 |
|
| 58 |
--source include/rpl_end.inc |