| 1 |
# Test case for BUG#4680 -- if there are extra files in the db directory |
| 2 |
# dropping the db on the master causes replication problems |
| 3 |
-- source include/have_myisam.inc |
| 4 |
-- source include/not_group_replication_plugin.inc |
| 5 |
-- source include/master-slave.inc |
| 6 |
-- source include/have_debug.inc |
| 7 |
|
| 8 |
--disable_warnings |
| 9 |
DROP DATABASE IF EXISTS test1; |
| 10 |
DROP DATABASE IF EXISTS test2; |
| 11 |
--enable_warnings |
| 12 |
CREATE DATABASE test1; |
| 13 |
CREATE DATABASE test2; |
| 14 |
|
| 15 |
CREATE TABLE test1.t1 (n INT); |
| 16 |
INSERT INTO test1.t1 VALUES(1); |
| 17 |
# Create an extra file in database directory |
| 18 |
SELECT * FROM test1.t1 INTO OUTFILE 'test1/f1.txt'; |
| 19 |
|
| 20 |
CREATE TABLE test1.t2 (n INT); |
| 21 |
CREATE TABLE test1.t3 (n INT); |
| 22 |
|
| 23 |
--replace_result \\ / |
| 24 |
--error ER_DB_DROP_RMDIR |
| 25 |
DROP DATABASE test1; |
| 26 |
|
| 27 |
# No tables should be dropped after WL#7743. |
| 28 |
--let assert_text= Tables in test1 database are not dropped |
| 29 |
--let assert_cond="[SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="test1"]"=3 |
| 30 |
--source include/assert.inc |
| 31 |
|
| 32 |
# Case when we fail while dropping tables and there are InnoDB tables only. |
| 33 |
let $MYSQLD_DATADIR= `select @@datadir`; |
| 34 |
remove_file $MYSQLD_DATADIR/test1/f1.txt; |
| 35 |
|
| 36 |
SET SESSION DEBUG='+d,rm_table_no_locks_abort_after_atomic_tables'; |
| 37 |
--error ER_UNKNOWN_ERROR |
| 38 |
DROP DATABASE test1; |
| 39 |
SET SESSION DEBUG='-d,rm_table_no_locks_abort_after_atomic_tables'; |
| 40 |
USE test1; |
| 41 |
# No tables should be dropped after WL#9536. |
| 42 |
--let assert_text= Tables in test1 database are not dropped |
| 43 |
--let assert_cond="[SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="test1"]"=3 |
| 44 |
--source include/assert.inc |
| 45 |
|
| 46 |
# Finally, case when we fail while dropping table and there are both InnoDB and MyISAM tables. |
| 47 |
CREATE TABLE test1.t5(n INT) ENGINE=MyISAM; |
| 48 |
|
| 49 |
SET SESSION DEBUG='+d,rm_table_no_locks_abort_after_atomic_tables'; |
| 50 |
--error ER_UNKNOWN_ERROR |
| 51 |
DROP DATABASE test1; |
| 52 |
SET SESSION DEBUG='-d,rm_table_no_locks_abort_after_atomic_tables'; |
| 53 |
|
| 54 |
--let assert_text= MyISAM table t5 is dropped |
| 55 |
--let assert_cond="[SHOW TABLES LIKE "t5"]"="" |
| 56 |
--source include/assert.inc |
| 57 |
|
| 58 |
--let assert_text= InnoDB tables in test1 database are not dropped |
| 59 |
--let assert_cond="[SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="test1"]"=3 |
| 60 |
--source include/assert.inc |
| 61 |
|
| 62 |
# Ensuring that replication is successful |
| 63 |
USE test2; |
| 64 |
CREATE TABLE t1 (n INT); |
| 65 |
INSERT INTO t1 VALUES (1234); |
| 66 |
|
| 67 |
# Cleanup |
| 68 |
DROP TABLE t1; |
| 69 |
|
| 70 |
#cleanup |
| 71 |
--source include/rpl_connection_master.inc |
| 72 |
|
| 73 |
DROP DATABASE test1; |
| 74 |
DROP DATABASE test2; |
| 75 |
|
| 76 |
--source include/rpl_end.inc |