Bug #9929 Error 'Duplicate entry '53' for key 1'
Submitted: 15 Apr 2005 13:50 Modified: 20 May 2005 22:26
Reporter: Don Choa Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:MySQL 4.0.24 OS:Linux (debian kernel 2.4.27)
Assigned to: CPU Architecture:Any

[15 Apr 2005 13:50] Don Choa
Description:
Hello, 

I have a problem with replication and it seems to be a bug because I do not have this problem without the replication.

Here the error:

 Last_error: Error 'Duplicate entry '53' for key 1' on query. Default
database: 'forum'. Query: 'INSERT INTO topics (login, num, topi
c, user, idlastrep, page) VALUES ('89225', '221', '6158', '82', '117809', '35
')'

The table is INNODB.
We have two differents server (master - master ). So do you think that the 2 servers tried to insert the same id at the same time?
Can we do something to correct this?
I repeat that I do not have this error without replication.

Thanks

How to repeat:
We use replication with 2 servers master-master and the table is INNOdb

Suggested fix:
Sorry I don't really know, it seems that the 2 servers tried to insert the same id at the same time.
[16 Apr 2005 8:50] Don Choa
Hello, 

I found something else:
The error in the other server is

Last_error: Error 'Duplicate entry '53' for key 1' on query. Default
database: 'forum'. Query: 'INSERT INTO topics (forum, signature, quote, hidden) VALUES ('6158', '246', '117809', '35')'

It is not exactly the same error because there is 246 instead of 82 in the first query.

So do you think that the 2
servers tried to insert the same id at the same time?
Can we do something to correct this?

Best Regards
[20 Apr 2005 22:26] Jorge del Conde
Hi!

Can you please try to provide us with a repeatable test-case that reproduces this behaviour ?  If you can't reproduce this bug, can you check your tables for corruption as this might be the cause of your problem ?

Thanks
[20 May 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[6 Jul 2006 8:34] Pooly
Hi,

Our replication setup is : master -> slave. It's 4.0.15 on both computers (binary provided with Mandrake Linux).
The replication has been running fine since two years, except four days ago :
Slave: Error 'Duplicate entry '215730' for key 1' on query 'INSERT INTO filler (Expiry,AMR,ITM,Quantity, Price, nTradeId,DateStamp) VALUES (20060700, 'K----060704500C', 'XXX', -2 3.0, 498, FROM_UNIXTIME(1151910879))' Error_code: 1062

I check if the 215730 PK was present in the filler table, but it was _not_. I just issued a "slave start" on the slave, and replication start running again without problem.
I don't have a test-case, since it only shows once in two years.