Sometimes when modifying data in MySQL a deadlock may occur:
zabbix_server.log: 24889:20110530:010220.231 [Z3005] Query failed:  Deadlock found when trying to get lock; try restarting transaction [insert into escalations (escalationid,actionid,triggerid,eventid,status) values (200000000018794,200200000000025,200200000023706,200200019036833,0)]
this leads to "Duplicate primary key" errors
zabbix_server.log: 24800:20110530:011134.440 [Z3005] Query failed:  Duplicate entry '200200019036927' for key 'PRIMARY' [insert into events (eventid,source,object,objectid,clock,ns,value) values (200200019036927,2,3,200200000000370,1306685494,0,1)]
The solution is to repeat these operations until they succeed.