Bug #52599 alter table remove partitioning on non-partitioned table corrupts myisam index
Submitted: 5 Apr 2010 16:46 Modified: 23 Nov 2011 19:28
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:5.1.30, 5.1.46, 5.5.9, 5.6.99-m4 OS:Any
Assigned to: CPU Architecture:Any
Tags: corruption
Triage: Triaged: D1 (Critical)

[5 Apr 2010 16:46] Shane Bester
Description:
removing partitioning from a valid myisam table corrupts it:

mysql> alter table `t1` remove partitioning;
ERROR 1034 (HY000): Incorrect key file for table 't1'; try to repair it

o) "repair table `t1` use_frm" is required to fix the table
o) 5.1.30 is affected too so this is not a recent regression.
o) different to bug #48645 since that testcase doesn't cause corruption anymore

How to repeat:
drop table if exists `t1`;
create table `t1`(`a` int)engine=myisam;
alter table `t1` add column `b` int;
create unique index `i1` on `t1`(`b`);
create unique index `i2` on `t1`(`a`);
alter table `t1` add primary key  (`a`);
alter table `t1` remove partitioning;
check table `t1` extended;
[5 Apr 2010 23:57] Miguel Solorzano
Thank you for the bug report. Verified as described.

mysql 5.1 >alter table `t1` remove partitioning;
ERROR 1034 (HY000): Incorrect key file for table 't1'; try to repair it
mysql 5.1 >check table `t1` extended;
+---------+-------+----------+-----------------------------------------------------+
| Table   | Op    | Msg_type | Msg_text                                            |
+---------+-------+----------+-----------------------------------------------------+
| mydb.t1 | check | Error    | Incorrect key file for table 't1'; try to repair it |
| mydb.t1 | check | error    | Corrupt                                             |
+---------+-------+----------+-----------------------------------------------------+
2 rows in set (0.00 sec)

mysql 5.1 >
[6 Apr 2010 15:31] gufo rosso
ALTER TABLE `appl_network` ADD INDEX ( `ip_sj` )

#1034 - Incorrect key file for table 'appl_network'; try to repair it 

replay bug:

add index
add retations
delete relations
delete index
add new index

INNODB
[23 Nov 2011 19:28] Paul Dubois
Noted in 5.6.4 changelog.

Using ALTER TABLE to remove partitioning from a valid MyISAM table
could corrupt it.