Bug #21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table
Submitted: 28 Aug 2006 13:25 Modified: 2 Nov 2006 9:06
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.1.12-BK, mysql-5.1.11-beta-linux-i686-glibc23 OS:Linux (Linux)
Assigned to: Martin Skold CPU Architecture:Any
Tags: cluster, crash, ndb, unique, USING HASH

[28 Aug 2006 13:25] Roland Bouman
Description:
A SQL node (MySQLD) crashes when an attempt is made to create a unique constraint USING HASH. 

After restarting mysqld, the node rejoins the cluster. As is to be expected, the unique constraint is not created. Instead, a new table is visable with a name like:

#sql-HHHH_N

where HHHH is a hexit, and N an integer

The described behaviour occurs regardless of the nullability or datatype of the column for which the constraint is created.

The described behaviour does not occur when the table is backed by the MyISAM, or when the USING HASH clause is omitted.

How to repeat:
create table test(id int not null) engine = NDB;

alter table test add constraint uk_test unique (id) using hash;

gives:

ERROR 2013 (HY000): Lost connection to MySQL server during query

Suggested fix:
Uhm...Don't crash - create the constraint instead?
[28 Aug 2006 13:25] Roland Bouman
updated to Cluster
[28 Aug 2006 15:17] Roland Bouman
Just want to add that it is possible to create the unique constraint using a workaround. This might help identifying the problem. This is the work around:
1) create a primary key (USING HASH can be used btw - no crash occurs with PRIMARY KEY ... USING HASH)
2) create the unique constraint as described - this time there is no crash!
3) drop the primary key.

So:

alter table test add primary key(id) using hash;

alter table test add constraint uk_test1 unique(id) using hash;

alter table test drop primary key;
[15 Sep 2006 14:26] Valeriy Kravchuk
Verified just as described with 5.1.12-BK on:

-bash-2.05b$ uname -a
Linux nocona.mysql.com 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17 17:46:36 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux
[20 Oct 2006 13:08] 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/14067

ChangeSet@1.2317, 2006-10-20 15:07:39+02:00, mskold@mysql.com +4 -0
  bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set
[24 Oct 2006 10:24] 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/14240

ChangeSet@1.2317, 2006-10-24 12:24:32+02:00, mskold@mysql.com +4 -0
  bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info to check for nullable fields
[1 Nov 2006 14:54] Jonas Oreland
pushed into 5.1.13
[2 Nov 2006 9:06] 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 for 5.1.12.