summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMats Kindahl <mats@mysql.com>2008-08-20 10:06:50 +0200
committerMats Kindahl <mats@mysql.com>2008-08-20 10:06:50 +0200
commitbe0acc4bcb9fe038c3e10ddc33b708bd346502cf (patch)
treea49d24662ad047a3777ec6c0a8e4e638d0407b0a /mysql-test
parent93d835213e1c5bb6bad455ef6a4877a960e638f3 (diff)
downloadmariadb-git-be0acc4bcb9fe038c3e10ddc33b708bd346502cf.tar.gz
Bug #38773: DROP DATABASE cause switch to stmt-mode when there are temporary tables open
When executing a DROP DATABASE statement in ROW mode and having temporary tables open at the same time, the existance of temporary tables prevent the server from switching back to row mode after temporarily switching to statement mode to handle the logging of the statement. Fixed the problem by removing the code to switch to statement mode and added code to temporarily disable the binary log while dropping the objects in the database. mysql-test/extra/binlog_tests/database.test: Added test to ensure that DROP DATABASE does not affect the replication mode. mysql-test/suite/binlog/r/binlog_database.result: Result file change. sql/sql_db.cc: Removed code that clears the current_stmt_binlog_row_based flag. Added code to disable the binary log while dropping the objects in a database.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/binlog_tests/database.test15
-rw-r--r--mysql-test/suite/binlog/r/binlog_database.result53
2 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test
index 11a8f53a6d7..2e445f98adf 100644
--- a/mysql-test/extra/binlog_tests/database.test
+++ b/mysql-test/extra/binlog_tests/database.test
@@ -13,3 +13,18 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
create procedure sp1 (a int) insert into t1 values(a);
drop database testing_1;
source include/show_binlog_events.inc;
+
+# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
+# temporary tables open
+
+use test;
+reset master;
+create temporary table tt1 (a int);
+create table t1 (a int);
+insert into t1 values (1);
+disable_warnings;
+drop database if exists mysqltest1;
+enable_warnings;
+insert into t1 values (1);
+drop table tt1, t1;
+source include/show_binlog_events.inc;
diff --git a/mysql-test/suite/binlog/r/binlog_database.result b/mysql-test/suite/binlog/r/binlog_database.result
index 7121d458077..d64d902217b 100644
--- a/mysql-test/suite/binlog/r/binlog_database.result
+++ b/mysql-test/suite/binlog/r/binlog_database.result
@@ -17,6 +17,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
+use test;
+reset master;
+create temporary table tt1 (a int);
+create table t1 (a int);
+insert into t1 values (1);
+drop database if exists mysqltest1;
+insert into t1 values (1);
+drop table tt1, t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # use `test`; drop table tt1, t1
set binlog_format=mixed;
reset master;
create database testing_1;
@@ -36,6 +52,22 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
+use test;
+reset master;
+create temporary table tt1 (a int);
+create table t1 (a int);
+insert into t1 values (1);
+drop database if exists mysqltest1;
+insert into t1 values (1);
+drop table tt1, t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # use `test`; insert into t1 values (1)
+master-bin.000001 # Query # # use `test`; drop table tt1, t1
set binlog_format=row;
reset master;
create database testing_1;
@@ -55,6 +87,27 @@ master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost`
master-bin.000001 # Query # # use `testing_1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`(a int)
insert into t1 values(a)
master-bin.000001 # Query # # drop database testing_1
+use test;
+reset master;
+create temporary table tt1 (a int);
+create table t1 (a int);
+insert into t1 values (1);
+drop database if exists mysqltest1;
+insert into t1 values (1);
+drop table tt1, t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; create table t1 (a int)
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
+master-bin.000001 # Query # # drop database if exists mysqltest1
+master-bin.000001 # Query # # use `test`; BEGIN
+master-bin.000001 # Table_map # # table_id: # (test.t1)
+master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
+master-bin.000001 # Query # # use `test`; COMMIT
+master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
show databases;
Database
information_schema