Bug #66134 | InnoDB tables under load produce duplicate copies of rows in queries | ||
---|---|---|---|
Submitted: | 1 Aug 2012 1:33 | Modified: | 18 Oct 2012 22:54 |
Reporter: | Graham Lea | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S1 (Critical) |
Version: | 5.5.25a, 5.5.28 | OS: | Any (Linux 3.2.0-27-generic #43-Ubuntu SMP x86_64 GNU/Linux (and others)) |
Assigned to: | CPU Architecture: | Any | |
Tags: | duplicate, query, regression |
[1 Aug 2012 1:33]
Graham Lea
[1 Aug 2012 1:34]
Graham Lea
BASH script that reproduces the problem
Attachment: mysql_bug_reproduction_clean.sh (application/x-shellscript, text), 1.71 KiB.
[1 Aug 2012 1:42]
Graham Lea
Apparently Bug #13817703 doesn't exist, although it is cited in the release notes for 5.5.23 and 5.5.24: http://dev.mysql.com/doc/refman/5.5/en/news-5-5-23.html http://dev.mysql.com/doc/refman/5.5/en/news-5-5-24.html
[1 Aug 2012 1:43]
Graham Lea
Note that the test case assumes the default storage engine on the DB is InnoDB.
[1 Aug 2012 2:27]
Graham Lea
For the benefit of others that may have similar problems, Hibernate was giving us error messages like this: "org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1" when we were pulling back a list of entities and then updating them. It was also giving us this one: "org.hibernate.HibernateException: More than one row with the given identifier was found: 122606513, for class:" while trying to retrieve a related entity based on a foreign key. In both of these scenarios, there is no code path that would result in duplicate values in the tables, but the most plausible explanation for the behaviour was that MySQL was returning duplicates of single rows.
[1 Aug 2012 13:53]
Valeriy Kravchuk
Verified just as described with recent mysql-5.5 from bzr on Mac OS X: macbook-pro:5.5 openxs$ bash ~/Downloads/mysql_bug_reproduction_clean.sh Creating table concurrent_test_table ... Creating scripts ... /tmp/concurrent_test_table_insert.sql /tmp/concurrent_test_table_delete.sql /tmp/concurrent_test_table_query.sql Running scripts in background ... Press CTRL-C to exit. *************************** 1. row *************************** NOW(): 2012-08-01 16:50:51 min(id): 2 max(id): 2 max(id) - min(id): 0 id count(T1.id) 6407 2 id count(T1.id) 9940 2 ^CTerminated
[18 Oct 2012 22:54]
John Russell
Added to changelog for 5.1.66, 5.5.28, 5.6.7, 5.7.0: Under heavy load of concurrent DML and queries, an InnoDB table with a unique index could return non-existent duplicate rows to a query.