mariadb/mysql-test/t/rpl_drop_temp.test
Alfranio Correia fe03c7dce6 BUG#46861 Auto-closing of temporary tables broken by replicate-rewrite-db
When a connection is dropped any remaining temporary table is also automatically
dropped and the SQL statement of this operation is written to the binary log in
order to drop such tables on the slave and keep the slave in sync. Specifically,
the current code base creates the following type of statement:
DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `db`.`table`;

Unfortunately, appending the database to the table name in this manner circumvents
the replicate-rewrite-db option (and any options that check the current database).
To solve the issue, we started writing the statement to the binary as follows:
use `db`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `table`;
2009-08-27 17:28:09 +01:00

24 lines
551 B
Text

source include/master-slave.inc;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
connect (con_temp,127.0.0.1,root,,test,$MASTER_MYPORT,);
connection con_temp;
use mysqltest;
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
select get_lock("con_temp",10);
connection master;
disconnect con_temp;
select get_lock("con_temp",10);
sync_slave_with_master;
connection slave;
show status like 'Slave_open_temp_tables';
connection master;
drop database mysqltest;
# End of 4.1 tests