Bug #54721 innodb secondary index corruption after fast alter table added it
Submitted: 23 Jun 2010 7:11 Modified: 23 Jun 2010 9:50
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S1 (Critical)
Version:5.1.47, 5.1.49-bzr, 5.5.5, plugin OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: corruption, fast alter table, old_alter_table

[23 Jun 2010 7:11] Shane Bester
Description:
secondary index gets corrupted after being added with fast alter table:

| Msg_type | Msg_text                                                        |
+----------+-----------------------------------------------------------------+
| Warning  | InnoDB: Index 'idx' contains 349520 entries, should be 698560. |
| error    | Corrupt                                                         |
+----------+-----------------------------------------------------------------+

How to repeat:
see private comment.  workaround: "set old_alter_table=1" before adding the index.
[23 Jun 2010 7:23] MySQL Verification Team
might be a duplicate of bug #54330
[23 Jun 2010 8:09] Jimmy Yang
Right. From the symptom, it is most likely a dup of 54330.
[23 Jun 2010 9:50] MySQL Verification Team
duplicate indeed.  I tried latest mysql-5.1-innodb source and there is no corruption.

+----------+-------+----------+----------+
| Table    | Op    | Msg_type | Msg_text |
+----------+-------+----------+----------+
| test.foo | check | status   | OK       | 
+----------+-------+----------+----------+
1 row in set (7.56 sec)

mysql> show global variables like '%version%';
+-------------------------+---------------------+
| Variable_name           | Value               |
+-------------------------+---------------------+
| innodb_version          | 1.0.10              | 
| protocol_version        | 10                  | 
| version                 | 5.1.49-debug        | 
| version_comment         | Source distribution | 
| version_compile_machine | x86_64              | 
| version_compile_os      | unknown-linux-gnu   | 
+-------------------------+---------------------+
6 rows in set (0.00 sec)