commit d0fac6fd63674b896f594f50f385c02288139f68 Author: Sachin <sachin.setiya@mariadb.com> Date: Wed Dec 19 16:33:00 2018 +0530 MDEV-17720 slave_ddl_exec_mode=IDEMPOTENT does not handle DROP DATABASE Relevant if exists flag are added for create database and drop database. diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 38b955d7697..c17cbb83fb9 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -67,6 +67,14 @@ 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 d; +include/check_slave_no_error.inc +drop database d; +drop database d; +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..32131381c70 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -75,9 +75,26 @@ 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; + +connection master; +create database d; + +sync_slave_with_master; +--source include/check_slave_no_error.inc +drop database d; + +connection master; +drop database d; +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 @@ case SQLCOM_PREPARE: 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 @@ case SQLCOM_PREPARE: 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)) -- Regards Sachin Setiya Software Engineer at MariaDB