diff options
author | bar@mysql.com <> | 2007-02-26 15:25:43 +0400 |
---|---|---|
committer | bar@mysql.com <> | 2007-02-26 15:25:43 +0400 |
commit | 8f97dea5f8c28b69e4492b71b923b9fe6382f845 (patch) | |
tree | 840e2c8cd1e24a28481b85b03abdb959e836d7ed /sql | |
parent | 3e760410a0d7b3db9ded319b86950663760705da (diff) | |
download | mariadb-git-8f97dea5f8c28b69e4492b71b923b9fe6382f845.tar.gz |
Bug#24478 DROP TRIGGER is not caught by replicate-*-table filters
Problem: DROP TRIGGER was not properly handled in combination
with slave filters, which made replication stop
Fix: loading table name before checking slave filters when
dropping a trigger.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_parse.cc | 25 | ||||
-rw-r--r-- | sql/sql_trigger.cc | 6 | ||||
-rw-r--r-- | sql/sql_trigger.h | 4 |
3 files changed, 30 insertions, 5 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b0b7afc6528..7226a8e3c86 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -33,6 +33,7 @@ #include "sp_head.h" #include "sp.h" #include "sp_cache.h" +#include "sql_trigger.h" #ifdef HAVE_OPENSSL /* @@ -2485,6 +2486,30 @@ mysql_execute_command(THD *thd) #ifdef HAVE_REPLICATION if (unlikely(thd->slave_thread)) { + if (lex->sql_command == SQLCOM_DROP_TRIGGER) + { + /* + When dropping a trigger, we need to load its table name + before checking slave filter rules. + */ + add_table_for_trigger(thd, thd->lex->spname, 1, &all_tables); + + if (!all_tables) + { + /* + If table name cannot be loaded, + it means the trigger does not exists possibly because + CREATE TRIGGER was previously skipped for this trigger + according to slave filtering rules. + Returning success without producing any errors in this case. + */ + DBUG_RETURN(0); + } + + // force searching in slave.cc:tables_ok() + all_tables->updating= 1; + } + /* Check if statment should be skipped because of slave filtering rules diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 3569733d064..0b648570b86 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -107,10 +107,6 @@ const LEX_STRING trg_event_type_names[]= }; -static int -add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists, - TABLE_LIST ** table); - class Handle_old_incorrect_sql_modes_hook: public Unknown_key_hook { private: @@ -1183,7 +1179,7 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, 1 Error */ -static int +int add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists, TABLE_LIST **table) { diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index 7e0fadfa677..8970986b931 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -139,3 +139,7 @@ private: extern const LEX_STRING trg_action_time_type_names[]; extern const LEX_STRING trg_event_type_names[]; + +int +add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists, + TABLE_LIST **table); |