Bug #33955 unexpectedly enabled indexes on MyISAM patitioned tables after LOAD DATA
Submitted: 21 Jan 2008 10:27 Modified: 23 Jan 2008 7:15
Reporter: Takashi Ichii Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Partitions Severity:S3 (Non-critical)
Version:5.1.22-rc OS:Linux
Assigned to: CPU Architecture:Any
Tags: bulk insert, disable indexes

[21 Jan 2008 10:27] Takashi Ichii
Description:
I want import large data into partitioned tables quickly, so did ALTER TABLE table_name DISABLE KEYS, and bulk-inserted by LOAD DATA (to be repeated). But after executing LOAD DATA, it was disappeared "disabled" at "Comment:" in output of SHOW INDEX FROM table_name.

How to repeat:
shell> seq 1 1000 > /home/ichii386/test.dat

mysql> create database foo;
Query OK, 1 row affected (0.00 sec)

mysql> use foo;
Database changed
mysql> create table foo (bar int, key (bar)) engine=myisam partition by hash(bar) partitions 2;
Query OK, 0 rows affected (0.00 sec)

mysql> alter table foo disable keys;
Query OK, 0 rows affected (0.00 sec)

mysql> show index from foo\G
*************************** 1. row ***************************
       Table: foo
  Non_unique: 1
    Key_name: bar
Seq_in_index: 1
 Column_name: bar
   Collation: A
 Cardinality: NULL
    Sub_part: NULL
      Packed: NULL
        Null: YES
  Index_type: BTREE
     Comment: disabled
1 row in set (0.00 sec)

mysql> load data local infile '/home/ichii386/test.dat' into table foo;
Query OK, 1000 rows affected (0.03 sec)
Records: 1000  Deleted: 0  Skipped: 0  Warnings: 0

mysql> show index from foo\G
*************************** 1. row ***************************
       Table: foo
  Non_unique: 1
    Key_name: bar
Seq_in_index: 1
 Column_name: bar
   Collation: A
 Cardinality: 1000
    Sub_part: NULL
      Packed: NULL
        Null: YES
  Index_type: BTREE
     Comment:
1 row in set (0.00 sec)

Suggested fix:
line 2915 in sql/ha_partition.cc:
> rows= rows/m_tot_parts + 1;
sets rows 1 if rows == 0, i think something wrong around here...
[23 Jan 2008 7:15] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with current development sources, although bug is repeatable with version 5.1.22. Please wait next release.