Bug #33056 slave do't check duplicate key error
Submitted: 7 Dec 2007 3:27 Modified: 7 Dec 2007 7:44
Reporter: Guangbao Ni Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:5.1.22-ndb-6.2.8 OS:Any
Assigned to: CPU Architecture:Any
Tags: duplicate key, ndb, rpl

[7 Dec 2007 3:27] Guangbao Ni
Description:
When master inserts a record with the same priamry key with the record already existed in slave, the slave doesn't throw a error out. Now the slave just recovers the existed record.

How to repeat:
1) on master:
   create table t1(i int primary key, ch  char(20))engine=ndb;
2) on slave:
   insert into t1 values(1, "bb");
3)on master:
   insert into t1 values(1, "aa");
4)on slave:
mysql> select * from t1;
+---+------+
| i | ch   |
+---+------+
| 1 | aa   |
+---+------+
1 row in set (0.00 sec)

Suggested fix:
should throw out a error and SQL thread die just as MyISAM and Innodb table.
[7 Dec 2007 7:42] Mats Kindahl
Assuming that the replication is run under row-based replication, this is an intentional design to allow for idempotent application of events (to overwrite existing rows).

Note that replication does not have any form of conflict detection currently (which is what this bug report suggests that it should have), and that in the current design, replication should only be use to transfer data from master to slave. This holds for statement-based replication as well as for row-based replication.

There is ongoing work to allow the strict application of rows, i.e., disallowing the idempotent application, but that is not yet in the server code.
[7 Dec 2007 7:44] Mats Kindahl
Duplicate of BUG#31609.
[18 Dec 2007 9:53] Guangbao Ni
It also has no any error when Statement Base Replication when engine is ndbcluster.  Yet when engine is non cluster, it will throw out error.