Skip to content

Commit 0ba1680

Browse files
committed
MDEV-6769 DROP TRIGGER IF NOT EXIST binlogged on master but not on slave
don't return from DROP TRIGGER IF NOT EXISTS on the slave side early when the trigger couldn't be read
1 parent b739103 commit 0ba1680

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

mysql-test/suite/rpl/r/rpl_trigger.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,4 +986,15 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
986986
include/diff_tables.inc [master:t1, slave:t1]
987987
include/diff_tables.inc [master:log, slave:log]
988988
drop table t1, log;
989+
drop trigger if exists notexistent;
990+
Warnings:
991+
Note 1360 Trigger does not exist
992+
include/show_binlog_events.inc
993+
Log_name Pos Event_type Server_id End_log_pos Info
994+
master-bin.000001 # Gtid # # GTID #-#-#
995+
master-bin.000001 # Query # # use `test`; drop trigger if exists notexistent
996+
include/show_binlog_events.inc
997+
Log_name Pos Event_type Server_id End_log_pos Info
998+
slave-bin.000001 # Gtid # # GTID #-#-#
999+
slave-bin.000001 # Query # # use `test`; drop trigger if exists notexistent
9891000
include/rpl_end.inc

mysql-test/suite/rpl/t/rpl_trigger.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,19 @@ connection master;
532532
drop table t1, log;
533533
sync_slave_with_master;
534534

535+
#
536+
# MDEV-6769 DROP TRIGGER IF NOT EXIST binlogged on master but not on slave
537+
#
538+
let $slave_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
539+
connection master;
540+
let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1);
541+
drop trigger if exists notexistent;
542+
source include/show_binlog_events.inc;
543+
sync_slave_with_master;
544+
let $binlog_start= $slave_pos;
545+
source include/show_binlog_events.inc;
546+
connection master;
547+
535548
#
536549
# End of tests
537550
#

sql/sql_parse.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,11 +2283,15 @@ mysql_execute_command(THD *thd)
22832283
according to slave filtering rules.
22842284
Returning success without producing any errors in this case.
22852285
*/
2286-
DBUG_RETURN(0);
2286+
if (!thd->lex->check_exists)
2287+
DBUG_RETURN(0);
2288+
/*
2289+
DROP TRIGGER IF NOT EXISTS will return without an error later
2290+
after possibly writing the query to a binlog
2291+
*/
22872292
}
2288-
2289-
// force searching in slave.cc:tables_ok()
2290-
all_tables->updating= 1;
2293+
else // force searching in slave.cc:tables_ok()
2294+
all_tables->updating= 1;
22912295
}
22922296

22932297
/*

0 commit comments

Comments
 (0)