Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Slave SQL: Error Duplicate entry 'xxxxxxx' for key 'PRIMARY''

Status
Not open for further replies.

tweenerz

Programmer
Mar 25, 2002
202
US
got a weird issue. I have a cron that runs and rapidly inserts multiple records in the db, and also have a web app that may insert at the same time. Neither query specifies the primary key field in the sql; both leaving it up to the auto_increment value. 99% of the time it works fine, but periodically we get the following error on the slave only (never on the primary):

Code:
30509 22:21:04 [ERROR] Slave SQL: Error 'Duplicate entry '2024638' for key 'PRIMARY'' on query. Default database: 'DBNAME'. Query: 'INSERT INTO `TABLENAME` (`FirstName`, ...

Its a standard master/slave setup (i.e. not dual master). I have no clue why the slave would be trying to insert a record with an id already in the table, especially considering the primary key isn't even specified in the query. But then again, I don't fully know how the master/slave sync process works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top