Bug #23576 Table is created although tablespace does not exist
Submitted: 24 Oct 2006 10:59 Modified: 7 Dec 2006 5:43
Reporter: Roland Bouman
Status: Closed
Category:Server: ClusterDD Severity:S3 (Non-critical)
Version:5.1.13 bk OS:Linux (ubuntu dapper drake)
Assigned to: Bugs System Target Version:
Tags: Tablespace, ndb, cluster, disk-based-storage

[24 Oct 2006 10:59] Roland Bouman
Description:
A table that is defined to be backed by the NDB engine and to reside in a non-existent
tablespace is created without an error or warning.

Of course, the table does not automatically create the tablespace - a normal, in-memory
table is created instead. 

How to repeat:
mysql> select * from information_schema.files;
Empty set (0.00 sec)

mysql> CREATE TABLE `City` (
    ->   `ID` int(11) NOT NULL,
    ->   `Name` char(35) NOT NULL default '',
    ->   `CountryCode` char(3) NOT NULL default '',
    ->   `District` char(20) NOT NULL default '',
    ->   `Population` int(11) NOT NULL default '0'
    -> )
    -> TABLESPACE tablespace_haworlddisk_1
    -> ENGINE=ndbcluster
    -> DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (1.65 sec)

mysql> show create table city;
+-------+---------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-+
| Table | Create Table                                                                 |
+-------+---------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-+
| city  | CREATE TABLE "city" (
  "ID" int(11) NOT NULL,
  "Name" char(35) NOT NULL DEFAULT '',
  "CountryCode" char(3) NOT NULL DEFAULT '',
  "District" char(20) NOT NULL DEFAULT '',
  "Population" int(11) NOT NULL DEFAULT '0'
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------
-+
1 row in set (0.00 sec)

mysql>

Suggested fix:
Please generate a warning, or preferably don't create the table and issue an error.
[15 Nov 2006 6:51] 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/15331

ChangeSet@1.2320, 2006-11-15 13:43:02+08:00, Justin.He@dev3-47.dev.cn.tlan +1 -0
  BUG#23576, Table is created although tablespace does not exist
[7 Dec 2006 5:43] 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

Bugfix documented in 5.1.14 changelog.