diff options
author | s.sujatha <sujatha.sivakumar@oracle.com> | 2014-12-29 12:17:55 +0530 |
---|---|---|
committer | s.sujatha <sujatha.sivakumar@oracle.com> | 2014-12-29 12:17:55 +0530 |
commit | 5da083ef67eabd92aa316ead7fc3a0af69655977 (patch) | |
tree | dface2a336fea2e15e3b92d69fb997e90fc87f2f /mysql-test/extra | |
parent | 901ce5314b6b0d4115b0237491e2afaafe5a274e (diff) | |
download | mariadb-git-5da083ef67eabd92aa316ead7fc3a0af69655977.tar.gz |
Bug#20041860: SLAVE ERROR WHEN DROP DATABASE
Fix:
===
Backport Bug#11756194 to mysql-5.5. slave breaks if
'drop database' fails on master and mismatched tables on
slave.
'DROP TABLE <deleted tables>' was binlogged when
'DROP DATABASE' failed and at least one table was deleted
from the database. The log event would lead slave SQL thread
stop if some of the tables did not exist on slave.
After this patch, It is always binlogged with 'IF EXISTS'
option.
Diffstat (limited to 'mysql-test/extra')
-rw-r--r-- | mysql-test/extra/binlog_tests/database.test | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/extra/binlog_tests/database.test b/mysql-test/extra/binlog_tests/database.test index d071415bf65..61e8b594185 100644 --- a/mysql-test/extra/binlog_tests/database.test +++ b/mysql-test/extra/binlog_tests/database.test @@ -31,12 +31,47 @@ 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; + --echo # --echo # Bug#11765416 58381: FAILED DROP DATABASE CAN BREAK STATEMENT --echo # BASED REPLICATION --echo # +USE test; --disable_warnings DROP DATABASE IF EXISTS db1; DROP TABLE IF EXISTS t3; |