Bug #38914 permanent table crash after truncate table with slash in keyname
Submitted: 20 Aug 2008 12:27 Modified: 18 Dec 2010 10:42
Reporter: Tim de Wolf Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-5.1-telco-6.2 OS:Linux (64bit)
Assigned to: Martin Skold CPU Architecture:Any
Tags: 5.1, 5.1-telco-6.2 bzr, 5.1.23-ndb-6.2.15, ndbcluster index slash keyname

[20 Aug 2008 12:27] Tim de Wolf
Description:
When I create a table with a slash ('/') in a key name, I am unable to truncate the table.
Errors 4243 "index not found" are given back by NDBCLUSTER.

Table will get in some _permanent_ error state. (might report as in use)
After this it is not possible to truncate or delete the table, and it is also not possible to delete the database.

The only workaround I have found is NOT to use a slash in the keyname. (before importing/creating table, altering doesnt always work)

How to repeat:
CREATE TABLE `inleveroverzicht` (
  `id` int(11) NOT NULL auto_increment,
  `klantid` int(11) NOT NULL default '0',
  `productcode` varchar(255) NOT NULL default '0',
  `aantal` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `klantid` (`klantid`),
  KEY `klantid/productcode` (`klantid`,`productcode`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1 AUTO_INCREMENT=34 ;
INSERT INTO `inleveroverzicht` (`id`, `klantid`, `productcode`, `aantal`) VALUES 
(33, 31, '15674', 11),
(32, 31, '0001256', 1);
#Query OK, 2 rows affected (0.00 sec)
#Records: 2  Duplicates: 0  Warnings: 0

TRUNCATE TABLE `inleveroverzicht`;
#ERROR 1005 (HY000): Can't create table 'bug.inleveroverzicht' (errno: 4243)

SELECT * from inleveroverzicht;
#ERROR 1296 (HY000): Got error 4243 'Index not found' from NDBCLUSTER

-------------------------------------------------------------------------------

CREATE TABLE `testcase` (
  `id` int(9) NOT NULL AUTO_INCREMENT,
  `field1` int(5) NOT NULL,
  `field2` char(10) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `name1/name2` (`field1`,`field2`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
#Query OK, 0 rows affected (0.99 sec)

INSERT INTO `testcase` ( `id` , `field1` , `field2` ) VALUES ( NULL , '12345', 'blabla' );
#Query OK, 1 row affected (0.01 sec)

TRUNCATE TABLE `testcase`;
#ERROR 1005 (HY000): Can't create table 'bug.testcase' (errno: 4243)

--------- next query doesnt always fail --------------
SHOW INDEX FROM `testcase` ;
#1296 - Got error 4243 'Index not found' from NDBCLUSTER 

--------- always fails: ------------
ALTER TABLE `testcase` DROP INDEX `name1/name2` , ADD INDEX `name1-name2` ( `field1` , `field2` ) ;
#ERROR 7 (HY000): Error on rename of './bug/testcase.ndb' to './bug/#sql2-e81-233.ndb' (Errcode: 2)
[21 Aug 2008 5:48] Sveta Smirnova
Thank you for the report.

Verified as described.
[3 Dec 2010 13:15] 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/125936

3142 Martin Skold	2010-12-03
      Bug#38914 permanent table crash after truncate table with slash in keyname: Ndb doesn't support '/' in index names so we need to transform that into the character code instead
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 13:44] 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/126936

3142 Martin Skold	2010-12-15
      Bug#38914 permanent table crash after truncate table with slash in keyname: Ndb doesn't support '/' in index names so we need to transform that into the character code instead
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:07] 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/126950

3340 Martin Skold	2010-12-15 [merge]
      Bug#38914 permanent table crash after truncate table with slash in keyname: merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:12] 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/126951

3980 Martin Skold	2010-12-15 [merge]
      Bug#38914 permanent table crash after truncate table with slash in keyname: merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:18] 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/126962

3970 Martin Skold	2010-12-15 [merge]
      Bug#38914 permanent table crash after truncate table with slash in keyname: merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:36] 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/126967

4062 Martin Skold	2010-12-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:36] 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/126968

3366 Martin Skold	2010-12-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:37] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.40 (revid:martin.skold@mysql.com-20101215143532-4dm2mbyd0mhzii53) (version source revid:martin.skold@mysql.com-20101215143532-4dm2mbyd0mhzii53) (merge vers: 5.1.51-ndb-6.3.40) (pib:23)
[15 Dec 2010 14:37] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.21 (revid:martin.skold@mysql.com-20101215143523-xoodewx5ovi214za) (version source revid:martin.skold@mysql.com-20101215143523-xoodewx5ovi214za) (merge vers: 5.1.51-ndb-7.0.21) (pib:23)
[15 Dec 2010 14:38] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101215143547-07lq01rzozm45sqd) (version source revid:martin.skold@mysql.com-20101215143547-07lq01rzozm45sqd) (merge vers: 5.1.51-ndb-6.2.19) (pib:23)
[15 Dec 2010 14:43] 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/126972

3142 Martin Skold	2010-12-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[15 Dec 2010 14:43] 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/126973

4023 Martin Skold	2010-12-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_index.result
        mysql-test/suite/ndb/t/ndb_index.test
        sql/ha_ndbcluster.cc
        sql/ha_ndbcluster.h
[18 Dec 2010 10:42] Jon Stephens
Documented fix in the NDB-6.2.19, 6.3.40, 7.0.21, and 7.1.10 changelogs, as follows:

        When a slash character (/) was used as part of the name of an
        index on an NDB table, attempting to execute a TRUNCATE TABLE
        statement on the table failed with the error Index not found,
        and the table was rendered unusable.

Closed.