Bug #28631 Bit index creation failure after alter
Submitted: 23 May 2007 20:58 Modified: 10 Jun 2007 19:00
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S1 (Critical)
Version:5.1.19-beta-debug OS:Linux (SUSE 10 64-bit)
Assigned to: Ramil Kalimullin CPU Architecture:Any
Tags: corruption, myisam

[23 May 2007 20:58] Peter Gulutzan
Description:
I create a table with a BIT(7) column.
I alter the table so it's a BIT(8) column.
I try to create an index.
I get an error message about an "Incorrect key file".

How to repeat:
mysql> create table th (s1 bit(7)) engine=myisam;
Query OK, 0 rows affected (0.03 sec)

mysql> alter table th modify column s1 bit(8);
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> create index ith on th (s1);
ERROR 1034 (HY000): Incorrect key file for table 'th'; try to repair it
[24 May 2007 9:21] Valeriy Kravchuk
Thank you for a bug report. Verified just as described on latest 5.1.19-BK.

5.0.44-BK does not have this bug:

mysql> create table th (s1 bit(7)) engine=myisam;
Query OK, 0 rows affected (0.02 sec)

mysql> alter table th modify column s1 bit(8);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> create index ith on th (s1);
Query OK, 0 rows affected (0.02 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.44-debug |
+--------------+
1 row in set (0.00 sec)
[24 May 2007 9:27] MySQL Verification Team
repair table doesn't want to fix it either.
[29 May 2007 11:27] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/27557

ChangeSet@1.2514, 2007-05-29 16:24:12+05:00, ramil@mysql.com +4 -0
  Fix for bug #28631: Bit index creation failure after alter
  
  Problem: altering a bit field we use Field::is_equal() to check if the bit 
  field is changed. Comparing the field type is not enough for bit fields.
  Fix: add proper Field_bit::is_equal() that compares the field lengths as well.
[6 Jun 2007 16:55] Bugs System
Pushed into 5.1.20-beta
[10 Jun 2007 19:00] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.20 changelog.