Description:
When executing lots (1000) of single INSERT statements from a single client in a short timespan (<=1 second), I get "Duplicate entry 'A' for key 3" and "Duplicate entry 'A' for key 7" errors while there is no duplication. When I slow things down by issuing a delay between inserts, there's no problem with the same data. The strange thing is that this error occurs most of the time (not always), and when it occurs, it always happens on records 301, 604, 810 and 908 (I didn't go further).
Using mysql Ver 14.3 Distrib 4.1.1-alpha, for slackware-linux (i486)
How to repeat:
CREATE TABLE QUESTIONS (
QUESTION_ID int(10) unsigned NOT NULL auto_increment,
SET_ID int(10) unsigned NOT NULL default '0',
QUESTION text NOT NULL,
QUESTION_TYPE int(1) unsigned NOT NULL default '0',
TIME_STAMP datetime NOT NULL default '0000-00-00 00:00:00',
ANSWER text,
HINT text,
COST_HINT decimal(3,2) default NULL,
TOPIC_KEYWORDS text,
TEXT_SEARCH_KEYWORDS text,
PRIMARY KEY (QUESTION_ID),
KEY QUESTIONS_SET_ID_I (SET_ID),
FULLTEXT KEY ANSWER (ANSWER),
FULLTEXT KEY QUESTION (QUESTION),
FULLTEXT KEY TOPIC_KEYWORDS (TOPIC_KEYWORDS),
FULLTEXT KEY TEXT_SEARCH_KEYWORDS (TEXT_SEARCH_KEYWORDS),
FULLTEXT KEY QUESTION_2 (QUESTION,ANSWER)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `QUESTIONS` (set_id,question,question_type,time_stamp,answer,hint,cost_hint) VALUES ( 0 , 'Question 0 ', 2 , NOW() , 'Answer to question 0 ', 'Hint to question 0 ', 0.5 ) ;
INSERT INTO `QUESTIONS` (set_id,question,question_type,time_stamp,answer,hint,cost_hint) VALUES ( 1 , 'Question 1 ', 2 , NOW() , 'Answer to question 1 ', 'Hint to question 1 ', 0.5 ) ;
INSERT INTO `QUESTIONS` (set_id,question,question_type,time_stamp,answer,hint,cost_hint) VALUES ( 2 , 'Question 2 ', 2 , NOW() , 'Answer to question 2 ', 'Hint to question 2 ', 0.5 ) ;
INSERT INTO `QUESTIONS` (set_id,question,question_type,time_stamp,answer,hint,cost_hint) VALUES ( 3 , 'Question 3 ', 2 , NOW() , 'Answer to question 3 ', 'Hint to question 3 ', 0.5 ) ;
...
And so on.
Fields that change with the counter: set_id, question, answer, hint.
Suggested fix:
Debug query serializer.