mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
ea06bbd2b0
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`;
22 lines
1,022 B
Text
22 lines
1,022 B
Text
drop database if exists `drop-temp+table-test`;
|
|
reset master;
|
|
create database `drop-temp+table-test`;
|
|
use `drop-temp+table-test`;
|
|
create temporary table shortn1 (a int);
|
|
create temporary table `table:name` (a int);
|
|
create temporary table shortn2 (a int);
|
|
select get_lock("a",10);
|
|
get_lock("a",10)
|
|
1
|
|
select get_lock("a",10);
|
|
get_lock("a",10)
|
|
1
|
|
show binlog events;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4
|
|
master-bin.000001 # Query 1 # create database `drop-temp+table-test`
|
|
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int)
|
|
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int)
|
|
master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int)
|
|
master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1`
|
|
drop database `drop-temp+table-test`;
|