Below is the list of changes that have just been committed into a local
5.0 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2351 07/02/26 15:25:43 bar@stripped +5 -0
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.
sql/sql_trigger.h
1.23 07/02/26 15:25:40 bar@stripped +4 -0
Making add_table_for_trigger() public
sql/sql_trigger.cc
1.61 07/02/26 15:25:40 bar@stripped +1 -5
Making add_table_for_trigger() public
sql/sql_parse.cc
1.597 07/02/26 15:25:40 bar@stripped +25 -0
Loading table name when dropping a trigger
before checking slave filtering rules.
mysql-test/t/rpl_replicate_do.test
1.26 07/02/26 15:25:40 bar@stripped +32 -0
Adding test case
mysql-test/r/rpl_replicate_do.result
1.34 07/02/26 15:25:40 bar@stripped +34 -0
Adding test case
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bar
# Host: bar.myoffice.izhnet.ru
# Root: /home/bar/mysql-5.0.b24478
--- 1.596/sql/sql_parse.cc 2006-12-09 02:33:36 +04:00
+++ 1.597/sql/sql_parse.cc 2007-02-26 15:25:40 +04:00
@@ -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 @@
#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
--- 1.60/sql/sql_trigger.cc 2006-12-01 16:02:51 +04:00
+++ 1.61/sql/sql_trigger.cc 2007-02-26 15:25:40 +04:00
@@ -107,10 +107,6 @@
};
-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 @@
1 Error
*/
-static int
+int
add_table_for_trigger(THD *thd, sp_name *trig, bool if_exists,
TABLE_LIST **table)
{
--- 1.22/sql/sql_trigger.h 2006-09-21 12:35:37 +05:00
+++ 1.23/sql/sql_trigger.h 2007-02-26 15:25:40 +04:00
@@ -139,3 +139,7 @@
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);
--- 1.33/mysql-test/r/rpl_replicate_do.result 2006-10-19 14:35:01 +05:00
+++ 1.34/mysql-test/r/rpl_replicate_do.result 2007-02-26 15:25:40 +04:00
@@ -41,3 +41,37 @@
ts
2005-08-12 00:00:00
drop table t1;
+*** master ***
+create table t1 (a int, b int);
+create trigger trg1 before insert on t1 for each row set new.b=2;
+create table t2 (a int, b int);
+create trigger trg2 before insert on t2 for each row set new.b=2;
+show tables;
+Tables_in_test
+t1
+t2
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
+trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost
+*** slave ***
+show tables;
+Tables_in_test
+t1
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost
+*** master ***
+drop trigger trg1;
+drop trigger trg2;
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+*** slave ***
+show tables;
+Tables_in_test
+t1
+show triggers;
+Trigger Event Table Statement Timing Created sql_mode Definer
+*** master ***
+drop table t1;
+drop table t2;
--- 1.25/mysql-test/t/rpl_replicate_do.test 2006-10-19 14:34:32 +05:00
+++ 1.26/mysql-test/t/rpl_replicate_do.test 2007-02-26 15:25:40 +04:00
@@ -59,3 +59,35 @@
sync_slave_with_master;
# End of 4.1 tests
+
+#
+# Bug#24478 DROP TRIGGER is not caught by replicate-*-table filters
+#
+--echo *** master ***
+connection master;
+create table t1 (a int, b int);
+create trigger trg1 before insert on t1 for each row set new.b=2;
+create table t2 (a int, b int);
+create trigger trg2 before insert on t2 for each row set new.b=2;
+show tables;
+show triggers;
+sync_slave_with_master;
+--echo *** slave ***
+connection slave;
+show tables;
+show triggers;
+--echo *** master ***
+connection master;
+drop trigger trg1;
+drop trigger trg2;
+show triggers;
+sync_slave_with_master;
+--echo *** slave ***
+connection slave;
+show tables;
+show triggers;
+--echo *** master ***
+connection master;
+drop table t1;
+drop table t2;
+sync_slave_with_master;
| Thread |
|---|
| • bk commit into 5.0 tree (bar:1.2351) BUG#24478 | bar | 26 Feb |