List:Commits« Previous MessageNext Message »
From:Li-Bing.Song Date:June 30 2010 10:05am
Subject:bzr commit into mysql-next-mr-rpl-merge branch (Li-Bing.Song:3001)
View as plain text  
#At file:///home/anders/work/bzrwork1/wt2/mysql-next-mr-rpl-merge/ based on revid:aelkin@stripped

 3001 Li-Bing.Song@stripped	2010-06-30 [merge]
      Manuel merge

    modified:
      mysql-test/extra/binlog_tests/database.test
      mysql-test/suite/binlog/r/binlog_database.result
      sql/sql_db.cc
=== modified file 'mysql-test/extra/binlog_tests/database.test'
--- a/mysql-test/extra/binlog_tests/database.test	2009-01-23 12:22:05 +0000
+++ b/mysql-test/extra/binlog_tests/database.test	2010-06-30 07:12:50 +0000
@@ -30,3 +30,37 @@ drop table tt1, t1;
 source include/show_binlog_events.inc;
 
 FLUSH STATUS;
+
+--echo 
+--echo # 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+--echo # when 'DROP DATABASE' fails and at least one table is deleted
+--echo # from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+
+let $prefix= `SELECT UUID()`;
+--echo # Create a file in the database directory
+--replace_result $prefix FAKE_FILE
+eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix';
+
+--echo
+--echo # 'DROP DATABASE' will fail if there is any other file in the the
+--echo # database directory
+
+# Use '/' instead of '\' in the error message. On windows platform, dir is
+# formed with '\'.
+--replace_regex /\\testing_1\\*/\/testing_1\//
+--error 1010
+DROP DATABASE testing_1;
+let $wait_binlog_event= DROP TABLE IF EXIST;
+source include/wait_for_binlog_event.inc;
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+--echo
+--echo # Remove the fake file.
+--remove_file $MYSQLD_DATADIR/testing_1/fake_file.$prefix
+--echo # Now we can drop the database.
+DROP DATABASE testing_1;

=== modified file 'mysql-test/suite/binlog/r/binlog_database.result'
--- a/mysql-test/suite/binlog/r/binlog_database.result	2010-04-20 09:10:43 +0000
+++ b/mysql-test/suite/binlog/r/binlog_database.result	2010-06-30 10:03:18 +0000
@@ -38,6 +38,26 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop table tt1, t1
 FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1/', errno: 17)
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
 set binlog_format=mixed;
 reset master;
 create database testing_1;
@@ -78,6 +98,26 @@ master-bin.000001	#	Query	#	#	use `test`
 master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; drop table tt1, t1
 FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1/', errno: 17)
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
 set binlog_format=row;
 reset master;
 create database testing_1;
@@ -120,6 +160,26 @@ master-bin.000001	#	Query	#	#	COMMIT
 master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
 master-bin.000001	#	Query	#	#	use `test`; DROP TEMPORARY TABLE IF EXISTS `tt1` /* generated by server */
 FLUSH STATUS;
+
+# 'DROP TABLE IF EXISTS <deleted tables>' is binlogged
+# when 'DROP DATABASE' fails and at least one table is deleted
+# from the database.
+RESET MASTER;
+CREATE DATABASE testing_1;
+USE testing_1;
+CREATE TABLE t1(c1 INT);
+CREATE TABLE t2(c1 INT);
+# Create a file in the database directory
+SELECT 'hello' INTO OUTFILE 'fake_file.FAKE_FILE';
+
+# 'DROP DATABASE' will fail if there is any other file in the the
+# database directory
+DROP DATABASE testing_1;
+ERROR HY000: Error dropping database (can't rmdir './testing_1/', errno: 17)
+
+# Remove the fake file.
+# Now we can drop the database.
+DROP DATABASE testing_1;
 show databases;
 Database
 information_schema

=== modified file 'sql/sql_db.cc'
--- a/sql/sql_db.cc	2010-06-23 09:56:24 +0000
+++ b/sql/sql_db.cc	2010-06-30 10:03:18 +0000
@@ -1034,7 +1034,7 @@ bool mysql_rm_db(THD *thd,char *db,bool 
 
     if (!(query= (char*) thd->alloc(MAX_DROP_TABLE_Q_LEN)))
       goto exit; /* not much else we can do */
-    query_pos= query_data_start= strmov(query,"drop table ");
+    query_pos= query_data_start= strmov(query,"DROP TABLE IF EXISTS ");
     query_end= query + MAX_DROP_TABLE_Q_LEN;
     db_len= strlen(db);
 


Attachment: [text/bzr-bundle] bzr/li-bing.song@sun.com-20100630100318-65nulgmy8po0pfvc.bundle
Thread
bzr commit into mysql-next-mr-rpl-merge branch (Li-Bing.Song:3001) Li-Bing.Song30 Jun