[MDEV-10924] CREATE OR REPLACE TRIGGER which fails on PRECEDES/FOLLOWS drops the trigger, but isn't written to binlog; replication fails Created: 2016-09-29  Updated: 2016-10-02  Resolved: 2016-10-02

Status: Closed
Project: MariaDB Server
Component/s: Replication, Triggers
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6112 multiple triggers per table Closed

 Description   

--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc
 
CREATE TABLE t1 (i INT);
 
CREATE OR REPLACE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW SET @a=1;
--error ER_REFERENCED_TRG_DOES_NOT_EXIST
CREATE OR REPLACE TRIGGER tr BEFORE DELETE ON t1 FOR EACH ROW PRECEDES non_existing_trigger SET @a=2;
SHOW TRIGGERS;
 
--sync_slave_with_master
SHOW TRIGGERS;

Result of this test case is that master and slave go out of sync: master has no triggers, but slave still has tr.
That's because when CREATE OR REPLACE TRIGGER, it still drops the trigger, but nothing is written to the binary log.

It's possible that the underlying problem exists in earlier versions, but I couldn't reproduce it with a few other errors which can happen on trigger re-creation.



 Comments   
Comment by Michael Widenius [ 2016-10-02 ]

Fixed by first testing if anchor trigger exists before deleting any trigger files

Generated at Thu Feb 08 07:45:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.