Duplicate error in replication with slave triggers and auto increment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
|||
Percona Server moved to https://jira.percona.com/projects/PS |
Fix Released
|
High
|
George Ormond Lorch III | ||
5.5 |
Fix Released
|
High
|
George Ormond Lorch III |
Bug Description
I can reproduce an issue similar to http://
This happens when there are more than one auto-increment table on master, slave has one or more them ignored but atleast one replicated, the replicated one has triggers into another table which is only on slave, and there are updates to these auto-increment tables on master.
To reproduce do the following:
A)
master:
use test;
create table t1(s auto_increment primary key);
create table t2(id int auto_increment primary key);
slave:
Make sure replicate-
use test;
create table slave_only(id int auto_increment primary key);
insert into slave_only values(NULL);
insert into slave_only values(NULL);
create trigger t1_update after update on t1 for each row insert into slave_only values(NULL);
create trigger t1_insert after insert on t1 for each row insert into slave_only values(NULL);
B)
master:
insert into t2 values(NULL);
insert into t2 values(NULL);
insert into t1 values(NULL);
slave:
show slave status\G
"Last_Error: Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'test'. Query: 'insert into t1 values (null)'"
Related branches
- Laurynas Biveinis (community): Approve
-
Diff: 113 lines (+85/-2)4 files modifiedPercona-Server/mysql-test/suite/rpl/r/rpl_trigger_bug67504.result (+28/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_trigger_bug67504-slave.opt (+1/-0)
Percona-Server/mysql-test/suite/rpl/t/rpl_trigger_bug67504.test (+49/-0)
Percona-Server/sql/sql_parse.cc (+7/-2)
tags: | added: i22680 |
tags: |
added: i26980 removed: i22680 |
no longer affects: | percona-server/5.6 |
tags: | added: upstream |
A typo here:
create table t1(s auto_increment primary key); should be create table t1(s int auto_increment primary key);