mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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. mysql-test/r/rpl_replicate_do.result: Adding test case mysql-test/t/rpl_replicate_do.test: Adding test case sql/sql_parse.cc: Loading table name when dropping a trigger before checking slave filtering rules. sql/sql_trigger.cc: Making add_table_for_trigger() public sql/sql_trigger.h: Making add_table_for_trigger() public
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user