Innodb produces false positive duplicate keys errors in Percona server 5.5
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Incomplete
|
Undecided
|
Unassigned |
Bug Description
Hello,
The error could be reproduced on a slave server, within STATEMENT binary log mode after upgrade to Percona-
CREATE TABLE `patient_pdups` (
`pat_id` int(10) unsigned NOT NULL DEFAULT '0',
`pat_id_match` int(10) unsigned NOT NULL DEFAULT '0',
`rating` smallint(5) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `idx1` (`pat_id`
UNIQUE KEY `idx2` (`pat_id_
KEY `idx3` (`rating`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
The query causes duplicate key error:
INSERT INTO patient_pdups (pat_id,
During fault both `idx1` & `idx2` produces duplicate key error in a random manner.
I have checked execution path for idx2 and it's very common for duplicate key: have a backtrace at /usr/src/
But I don't understand why it produces duplicate key error, because SELECT * WHERE (pat_id='1864' AND pat_id_
At the same time there is no row with such pat_id & pat_id_match fields combination as in insert query.
Before the error appearrs I can always see strange entries in mysql error log:
InnoDB: Warning: hash index ref_count (182) is not zero after fil_discard_
index: "idx1" table: "xx_xxxxx_
InnoDB: Warning: hash index ref_count (87) is not zero after fil_discard_
index: "idx2" table: "xx_xxxxx_
InnoDB: Warning: hash index ref_count (97) is not zero after fil_discard_
index: "idx3" table: "xx_xxxxx_
After reboot the same statement executes correctly. Additional inserts producing normal duplicate key error messages, but only with `idx1`.
The slave server is crated from xtrabackup dump which is created on another 5.1 slave, transaction logs correctly applied, mysql_upgrade executed.
During the test there is only replication log, no other queries executed. No other 5.5 binaries tested yet.
I tested with a 5.1 master (5.1.66) and 5.5 slave (5.5.28-29.2) /gist.github. com/d58f40f14f5 530765cee
with config in
https:/
However, I have not been able to reproduce it yet
The values were inserted like
INSERT INTO patient_pdups (pat_id, pat_id_ match,rating) VALUES ('18,'19' ,'11'), ('19',' 18','31' ); in a loop.
However, it needs to be verified if this can be rproduced with a xtrabackup dump from 5.1 mysql_upgraded to 5.5 slave.
Regarding,
"" tablespace( ). xxxx/patient_ pdups" tablespace( ). xxxx/patient_ pdups" tablespace( ). xxxx/patient_ pdups"
InnoDB: Warning: hash index ref_count (182) is not zero after fil_discard_
index: "idx1" table: "xx_xxxxx_
InnoDB: Warning: hash index ref_count (87) is not zero after fil_discard_
index: "idx2" table: "xx_xxxxx_
InnoDB: Warning: hash index ref_count (97) is not zero after fil_discard_
index: "idx3" table: "xx_xxxxx_
""
it looks like the index may be inconsistent here, since the ref_count refers to the number of blocks in the index with search index built which remain after a discard_tablespace.