Commit e0c136b4 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9737 Duplicate error in replication with slave triggers and auto increment

delete deferred events after they're executed
(otherwise they can be executed again for a sub-statement)

See also
commit 0e78d1d
Author: Venkatesh Duggirala <venkatesh.duggirala@oracle.com>
Date:   Wed Mar 20 11:20:47 2013 +0530

    BUG#15850951-DUPLICATE ERROR IN REPLICATION WITH SLAVE
    TRIGGERS AND AUTO INCREMENT
parent d5a80519
include/master-slave.inc
[connection master]
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1(id int auto_increment primary key);
create table t2(id int auto_increment primary key);
create table slave_only(id int auto_increment primary key);
insert into slave_only values(NULL);
create trigger t1i after insert on t1 for each row insert into slave_only values(NULL);
stop slave;
set global replicate_ignore_table="test.t2";
start slave;
insert into t2 values(NULL);
insert into t1 values(NULL);
drop table t1, t2, slave_only;
stop slave;
set global replicate_ignore_table="";
start slave;
drop table t1, t2;
include/rpl_end.inc
#
# MDEV-9737 Duplicate error in replication with slave triggers and auto increment
#
source include/master-slave.inc;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
create table t1(id int auto_increment primary key);
create table t2(id int auto_increment primary key);
sync_slave_with_master;
create table slave_only(id int auto_increment primary key);
insert into slave_only values(NULL);
create trigger t1i after insert on t1 for each row insert into slave_only values(NULL);
stop slave;
set global replicate_ignore_table="test.t2";
start slave;
connection master;
insert into t2 values(NULL);
insert into t1 values(NULL);
sync_slave_with_master;
drop table t1, t2, slave_only;
stop slave;
set global replicate_ignore_table="";
start slave;
connection master;
drop table t1, t2;
source include/rpl_end.inc;
......@@ -7463,6 +7463,7 @@ bool slave_execute_deferred_events(THD *thd)
return res;
res= rgi->deferred_events->execute(rgi);
rgi->deferred_events->rewind();
return res;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment