Bug #64432 Bug #54330 (Broken fast index creation) was never fixed in 5.5
Submitted: 23 Feb 2012 11:49 Modified: 9 May 2013 14:01
Reporter: Laurynas Biveinis (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Jimmy Yang CPU Architecture:Any

[23 Feb 2012 11:49] Laurynas Biveinis
Description:
Comments in bug 54430 and changelog for 5.5.6 say that this bug has been fixed there.  

This is actually not true.

The fix for 5.1 is revision 3351.14.149. The 5.5 revision that supposedly fixed this is 3069.4.4 and is in fact a null-merge.  Another way to confirm is to compare the patch for 3351.14.149 with the current 5.5 code and this will show that there is no trace of the fix there.

How to repeat:
You should be able to repeat this on 5.5 with the original data from bug 54430. 

We have a big testcase for this bug too that fails with 5.5 and passes with the fix applied.

Suggested fix:
Actually port the fix 5.1 -> 5.5.
[23 Feb 2012 11:50] Laurynas Biveinis
Argh, s/54430/54330/g in the descriptions :/
[23 Feb 2012 12:52] Laurynas Biveinis
A small testcase is the following. When the bug is present the two select count(*) will return 517672 and 262144 for the same data.

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (
       id BIGINT(20) AUTO_INCREMENT PRIMARY KEY,
       bar BIGINT(20)
) ENGINE=InnoDB;

--disable_query_log
SET AUTOCOMMIT=0;
let $1= 515641;
while ($1)
{
  eval INSERT INTO t1 (bar) VALUES (NULL);
  dec $1;
}
let $1= 2031;
while ($1)
{
  eval INSERT INTO t1 (bar) VALUES ($1);
  dec $1;
}
COMMIT;
--enable_query_log

SELECT COUNT(*) FROM t1;

ALTER TABLE t1 ADD INDEX baz (bar);

SELECT COUNT(*) FROM t1 FORCE INDEX (baz);

DROP TABLE t1;
[24 Feb 2012 1:18] Jimmy Yang
This was a time when the merge was done periodically, and not by developers. And indeed, 3069.4.4 is a null merge for some reason:

revno: 3069.4.4 [merge]
revision-id: vasil.dimov@oracle.com-20100704073004-f4jgawypg71j1maf
parent: jimmy.yang@oracle.com-20100629071420-ctx5xcriz5li4yby
parent: sunny.bains@oracle.com-20100625081841-ppulnkjk1qlazh82
committer: Vasil Dimov <vasil.dimov@oracle.com>
branch nick: mysql-trunk-security
timestamp: Sun 2010-07-04 10:30:04 +0300
message:
  Null-merge mysql-5.1-innodb -> mysql-trunk-innodb up to
  sunny.bains@oracle.com-20100625081841-ppulnkjk1qlazh82

The bug should be applied.
[24 Feb 2012 3:51] Laurynas Biveinis
This probably won't be news to you, but after merging 3351.14.149 to 5.5, revision 3351.54.1 needs to be merged there too.
[24 Feb 2012 4:05] Jimmy Yang
That is correct, it is merged together.
[15 Mar 2013 12:35] Bugs System
Closing. As stated above, there is an existing changelog entry for 5.1 and 5.5 (5.1.49, 5.5.6). No changelog update required. Here is the changelog entry:

"Fast index creation in the InnoDB Plugin could fail, leaving the new secondary index corrupted."
[9 May 2013 14:01] Laurynas Biveinis
5.6$ bzr log -r 2875.341.21
------------------------------------------------------------
revno: 2875.341.21
committer: Jimmy Yang <jimmy.yang@oracle.com>
branch nick: mysql-5.5
timestamp: Fri 2012-02-24 21:21:07 +0800
message:
  Fix Bug #64432 Port bug fix #54330 from mysql-5.1 to mysql-5.5
[1 Apr 2014 16:22] Daniel Price
Due to the null merge, the patch was not applied to 5.5.6, as previous documented. For 5.5, the patch first appears in the 5.5.23 release. The following changelog entry now appears in the 5.1.49 and 5.5.23 release notes:

"Fast index creation in the InnoDB Plugin could fail, leaving the new secondary index corrupted."