# Bug in fast index creation ?

**URL:** <https://forums.percona.com/t/bug-in-fast-index-creation/1427>\
**Category:** Other MySQL® Questions\
**Created:** [June 4, 2010, 2:37pm UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427 "2010-06-04T14:37:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pservit](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@pservit](https://forums.percona.com/u/pservit)\
**Post date:** [June 4, 2010, 2:37pm UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/1 "2010-06-04T14:37:00Z")

</div>

my.cnf:

[client]#password = your\_passwordport = 3306socket = /tmp/mysql.sock[mysqld]port = 3306socket = /tmp/mysql.sockuser = mysqldatadir = /var/db/mysqlbasedir = /usr/localtmpdir = /var/db/tmpmax\_connect\_errors = 10innodb\_file\_format=Barracudainnodb\_file\_per\_table

mysql\> show create table Files \G

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Table: FilesCreate Table: CREATE TABLE `Files` ( `ID` int(10) unsigned NOT NULL AUTO\_INCREMENT, `MD5Hash` char(32) NOT NULL DEFAULT ‘’, `SHA256Hash` char(64) NOT NULL DEFAULT ‘’, `FileSize` int(11) NOT NULL DEFAULT ‘0’, `Ext` char(4) NOT NULL DEFAULT ‘’, PRIMARY KEY (`ID`), KEY `File_k_2` (`MD5Hash`(4),`SHA256Hash`(4),`FileSize`)) ENGINE=InnoDB AUTO\_INCREMENT=22728476 DEFAULT CHARSET=utf81 row in set (0.00 sec)

mysql\> create table Files2 like Files;

Query OK, 0 rows affected (0.02 sec)

mysql\> insert into Files2 select \* from Files limit 375000;

Query OK, 375000 rows affected (15.75 sec)Records: 375000 Duplicates: 0 Warnings: 0

mysql\> check table Files2;

±------------±------±---------±---------+| Table | Op | Msg\_type | Msg\_text |±------------±------±---------±---------+| test.Files2 | check | status | OK |±------------±------±---------±---------+1 row in set (1.23 sec)

recreating index:

mysql\> alter table Files2 drop KEY `File_k_2`;

Query OK, 0 rows affected (0.02 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql\> alter table Files2 add KEY `File_k_2` (`MD5Hash`(4),`SHA256Hash`(4),`FileSize`);

Query OK, 0 rows affected (1.23 sec)Records: 0 Duplicates: 0 Warnings: 0

mysql\> check table Files2;

±------------±------±---------±---------+| Table | Op | Msg\_type | Msg\_text |±------------±------±---------±---------+| test.Files2 | check | error | Corrupt |±------------±------±---------±---------+1 row in set (0.66 sec)

message in .err:

Error: index `File_k_2` of table `test`.`Files2` contains 20164 entries, should be 375000

Is it bug or I missed something ?  
I tried Percona-Server 5.1.45-rel10.2 and MySQL 5.1.47 with built-in InnoDB plugin.

---

<div class="post-metadata">

**Author:** ![xaprb](https://avatars.discourse-cdn.com/v4/letter/x/49beb7/32.png) [@xaprb](https://forums.percona.com/u/xaprb)\
**Post date:** [June 7, 2010, 6:00am UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/2 "2010-06-07T06:00:46Z")

</div>

That certainly looks like a bug. What if you don’t use the Barracuda format? Did you search [bugs.mysql.com](http://bugs.mysql.com) for a related bug?

---

<div class="post-metadata">

**Author:** ![pservit](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@pservit](https://forums.percona.com/u/pservit)\
**Post date:** [June 7, 2010, 7:08am UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/3 "2010-06-07T07:08:47Z")

</div>

| [B]xaprb wrote on Mon, 07 June 2010 07:30[/B] |
| That certainly looks like a bug. What if you don't use the Barracuda format? |

Without Barracuda all works without errors, but very long.  
With smaller dataset (200k rows) Barracuda also works fine.

| [B]xaprb wrote on Mon, 07 June 2010 07:30[/B] |
| Did you search bugs.mysql.com for a related bug? |

Yes, but I found only closed bugs about data corruption.

---

<div class="post-metadata">

**Author:** ![krteq](https://avatars.discourse-cdn.com/v4/letter/k/c57346/32.png) [@krteq](https://forums.percona.com/u/krteq)\
**Post date:** [June 8, 2010, 3:21am UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/4 "2010-06-08T03:21:52Z")

</div>

I’m able to reproduce it on standard 5.1.47, Innodb plugin 1.0.8. It’s definitely a bug. Pservit, can you file the bug report please?

Output:

mysql\> \s--------------mysql Ver 14.14 Distrib 5.1.47, for redhat-linux-gnu (x86\_64) using readline 5.1Connection id: 7126Current database: testCurrent user: root@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.1.47-log MySQL Community Server (GPL) by RemiProtocol version: 10Connection: Localhost via UNIX socketServer characterset: utf8Db characterset: utf8Client characterset: latin1Conn. characterset: latin1UNIX socket: /var/lib/mysql/mysql.sockmysql\> show create table Files2 \G\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* 1. row \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* Table: Files2Create Table: CREATE TABLE `Files2` ( `ID` int(10) unsigned NOT NULL AUTO\_INCREMENT, `MD5Hash` char(32) NOT NULL DEFAULT ‘’, `SHA256Hash` char(64) NOT NULL DEFAULT ‘’, `FileSize` int(11) NOT NULL DEFAULT ‘0’, `Ext` char(4) NOT NULL DEFAULT ‘’, PRIMARY KEY (`ID`), KEY `File_k_2` (`MD5Hash`(4),`SHA256Hash`(4),`FileSize`)) ENGINE=InnoDB AUTO\_INCREMENT=426137 DEFAULT CHARSET=utf81 row in set (0.00 sec)mysql\> create table Files like Files2;Query OK, 0 rows affected (0.02 sec)mysql\> insert into Files select \* from Files2 limit 375000;Query OK, 375000 rows affected (8.00 sec)Records: 375000 Duplicates: 0 Warnings: 0mysql\> check table Files;±-----------±------±---------±---------+| Table | Op | Msg\_type | Msg\_text |±-----------±------±---------±---------+| test.Files | check | status | OK |±-----------±------±---------±---------+1 row in set (19.24 sec)mysql\> alter table Files drop KEY `File_k_2`;Query OK, 0 rows affected (0.03 sec)Records: 0 Duplicates: 0 Warnings: 0mysql\> alter table Files add KEY `File_k_2` (`MD5Hash`(4),`SHA256Hash`(4),`FileSize`);Query OK, 0 rows affected (0.93 sec)Records: 0 Duplicates: 0 Warnings: 0mysql\> check table Files;±-----------±------±---------±-------------------------------------------------------------------+| Table | Op | Msg\_type | Msg\_text |±-----------±------±---------±-------------------------------------------------------------------+| test.Files | check | Warning | InnoDB: Index ‘File\_k\_2’ contains 20164 entries, should be 375000. || test.Files | check | error | Corrupt |±-----------±------±---------±-------------------------------------------------------------------+2 rows in set (18.54 sec)

Uptime: 1 day 2 hours 23 min 54 sec

---

<div class="post-metadata">

**Author:** ![pservit](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@pservit](https://forums.percona.com/u/pservit)\
**Post date:** [June 8, 2010, 4:14am UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/5 "2010-06-08T04:14:53Z")

</div>

| [B]krteq wrote on Tue, 08 June 2010 04:51[/B] |
| I'm able to reproduce it on standard 5.1.47, Innodb plugin 1.0.8. It's definitely a bug. Pservit, can you file the bug report please? |

Thank you.

[URL=“http&#58;&#47;&#47;[MySQL Bugs: #54330: Broken fast index creation](http://bugs.mysql.com/bug.php?id=54330)”][MySQL Bugs: #54330: Broken fast index creation](http://bugs.mysql.com/bug.php?id=54330%5B/URL%5D)

---

<div class="post-metadata">

**Author:** ![gmouse](https://avatars.discourse-cdn.com/v4/letter/g/b9e5f3/32.png) [@gmouse](https://forums.percona.com/u/gmouse)\
**Post date:** [June 17, 2010, 5:52am UTC](https://forums.percona.com/t/bug-in-fast-index-creation/1427/6 "2010-06-17T05:52:49Z")

</div>

Good job, hope that Percona will release an update soon.
