Bug #92253 auto_increment column produce duplicate value
Submitted: 31 Aug 2018 4:06 Modified: 31 Aug 2018 10:05
Reporter: mike feng Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.7.16 Source distribution OS:Linux (embed system)
Assigned to: CPU Architecture:ARM (armv7l)
Tags: auto_increment, duplicate key

[31 Aug 2018 4:06] mike feng
Description:
After my application had been run a long period as expected, 
when execute this statment:
insert into result_data_detail(resultid,'time',config_seq_no,value) values ('000000000055623','2018-08-3017:34:48',13,'119.191');
I got error:
ERROR 1062(23000):Duplicate entry '253416' for key 'PRIMARY'. 
Now, there were 253415 rows data in table result_data_detail.

the table is defined as:

CREATE TABLE `result_data_detail` (
    `id` INT(15) PRIMARY KEY AUTO_INCREMENT NOT NULL COMMENT 'auto_increment field',
    `resultid` VARCHAR(27) NOT NULL COMMENT 'id of result_data',
    `time` DATETIME NOT NULL COMMENT 'creation time',
    `config_seq_no` INT(11) NOT NULL COMMENT 'sequence number of algo config detail',
    `value` VARCHAR(50) DEFAULT NULL COMMENT 'value of the property, convert by property type'
)  COLLATE = UTF8_GENERAL_CI ENGINE=MYISAM
;

More background:

every time, I will write data in a loop, it looks like this:
for (int i = 0; i < 10; ++i)
{
get a connection from connection pool;
do insert operation;
}

How to repeat:
I am afraid it is not easy to repeat.

Suggested fix:
I don't know why, so I have no suggestion.
[31 Aug 2018 4:09] mike feng
I had temporarily resolve this issue by :
alter table result_data_detail auto_increment 253416;

I hope this help.
[31 Aug 2018 5:18] mike feng
when 
select * from result_data_detail where id = 253416

returns 0 row.
[31 Aug 2018 10:05] MySQL Verification Team
Hello Mike,

Thank you for the report.
This issue was initially fixed in 5.7.17 after Bug #76872, which was again resurfaced in Bug #88321.  Marking this as duplicate of Bug #88321.

regards,
Umesh