summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin <sachin.setiya@mariadb.com>2018-12-19 16:33:00 +0530
committerSachin <sachin.setiya@mariadb.com>2018-12-19 19:23:25 +0530
commit7d7a422b58eae7cd473e99c4dbcdff22d1b306ca (patch)
treec8ae17e57fa3d88810d5593d9754d6e59ecdd956
parent7e606a2d5ca59dbd901b7c8909214a0fc12fbadd (diff)
downloadmariadb-git-bb-10.0-17720.tar.gz
MDEV-17720 slave_ddl_exec_mode=IDEMPOTENT does not handle DROP DATABASEbb-10.0-17720
Relevant if exists flag are added for create database and drop database.
-rw-r--r--mysql-test/suite/rpl/r/rpl_idempotency.result12
-rw-r--r--mysql-test/suite/rpl/t/rpl_idempotency.test21
-rw-r--r--sql/sql_parse.cc6
3 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result
index 38b955d7697..03482e6fefb 100644
--- a/mysql-test/suite/rpl/r/rpl_idempotency.result
+++ b/mysql-test/suite/rpl/r/rpl_idempotency.result
@@ -67,6 +67,18 @@ a
-3
1
include/check_slave_no_error.inc
+drop table t1, t2;
DROP TABLE t1, t2;
+include/check_slave_no_error.inc
+create database d;
+create database e;
+create database d;
+create database if not exists e;
+include/check_slave_no_error.inc
+drop database d;
+drop database e;
+drop database d;
+drop database if exists e;
+include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test
index 186c6260154..e801aac9b5e 100644
--- a/mysql-test/suite/rpl/t/rpl_idempotency.test
+++ b/mysql-test/suite/rpl/t/rpl_idempotency.test
@@ -75,9 +75,30 @@ SELECT * FROM t1 ORDER BY a;
SELECT * FROM t2 ORDER BY a;
--source include/check_slave_no_error.inc
+connection slave;
+drop table t1, t2;
+
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;
+--source include/check_slave_no_error.inc
+create database d;
+create database e;
+
+connection master;
+create database d;
+create database if not exists e;
+
+sync_slave_with_master;
+--source include/check_slave_no_error.inc
+drop database d;
+drop database e;
+
+connection master;
+drop database d;
+drop database if exists e;
+sync_slave_with_master;
+--source include/check_slave_no_error.inc
SET @@global.slave_exec_mode= @old_slave_exec_mode;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index a9849c7248d..5ca22f0dedc 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3884,6 +3884,9 @@ end_with_restore_list:
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
+ if (slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT &&
+ !(lex->create_info.options & HA_LEX_CREATE_IF_NOT_EXISTS))
+ create_info.options|= HA_LEX_CREATE_IF_NOT_EXISTS;
}
#endif
if (check_access(thd, CREATE_ACL, lex->name.str, NULL, NULL, 1, 0))
@@ -3915,6 +3918,9 @@ end_with_restore_list:
my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0));
break;
}
+ if (!thd->slave_expected_error &&
+ slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
+ lex->check_exists= 1;
}
#endif
if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0))