Description:
Short summary .. I created tables and tablespaces as documented on
http://mikaelronstrom.blogspot.com/2006/02/how-to-define-table-that-uses-disk.html
I filled up all my tablespaces with dummy data, then
dropped the table and according to the files table the space was
available again, so I recreated my table and tried to insert stuff into
which failed and kept failing till I added yet another datafile.
Should I have flushed my tables or so ?
Here's the output.
How to repeat:
mysql> select file_id, file_name , tablespace_name , engine,
free_extents, total_extents, data_free, status from files;
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| file_id | file_name | tablespace_name | engine | free_extents
| total_extents | data_free | status |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 1
| 40 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 1
| 40 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 0
| 400 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 10
| 400 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159504
| 1048576 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159504
| 1048576 | NULL | NORMAL |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
10 rows in set (0.01 sec)
mysql> drop table test.t2;
Query OK, 0 rows affected (0.81 sec)
mysql> select file_id, file_name , tablespace_name , engine,
free_extents, total_extents, data_free, status from files;
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| file_id | file_name | tablespace_name | engine | free_extents
| total_extents | data_free | status |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 400
| 400 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 400
| 400 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159504
| 1048576 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159504
| 1048576 | NULL | NORMAL |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
10 rows in set (0.02 sec)
mysql> CREATE TABLE t2 (a int, b int, text varchar(255), primary key
(a), index(a,b)) TABLESPACE ts1 STORAGE DISK engine=ndb;
Query OK, 0 rows affected (1.24 sec)
mysql> select * from t2;
Empty set (0.02 sec)
mysql> select file_id, file_name , tablespace_name , engine,
free_extents, total_extents, data_free, status from
information_schema.files;
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| file_id | file_name | tablespace_name | engine | free_extents
| total_extents | data_free | status |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 400
| 400 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 399
| 400 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159502
| 1048576 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4159502
| 1048576 | NULL | NORMAL |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
10 rows in set (0.01 sec)
mysql> insert into t2 values (11,0,"lotsta text in here that doesnt
really matter 1");
ERROR 1114 (HY000): The table 't2' is full
mysql> select * from t2;
Empty set (0.00 sec)
mysql> ALTER TABLESPACE ts1 ADD DATAFILE 'datafile05.dat' INITIAL_SIZE
400M ENGINE=NDB;
Query OK, 0 rows affected (7.54 sec)
mysql> insert into t2 values (11,0,"lotsta text in here that doesnt
really matter 1");
Query OK, 1 row affected (0.01 sec)
mysql> select file_id, file_name , tablespace_name , engine,
free_extents, total_extents, data_free, status from
information_schema.files;
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| file_id | file_name | tablespace_name | engine | free_extents
| total_extents | data_free | status |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile02.dat | ts1 | ndbcluster | 4
| 4 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile.dat | ts1 | ndbcluster | 12
| 12 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile03.dat | ts1 | ndbcluster | 40
| 40 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 400
| 400 | NULL | NORMAL |
| 0 | datafile04.dat | ts1 | ndbcluster | 399
| 400 | NULL | NORMAL |
| 0 | datafile05.dat | ts1 | ndbcluster | 399
| 400 | NULL | NORMAL |
| 0 | datafile05.dat | ts1 | ndbcluster | 400
| 400 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4151311
| 1048576 | NULL | NORMAL |
| 0 | undofile.dat | ts1 | ndbcluster | 4151311
| 1048576 | NULL | NORMAL |
+---------+----------------+-----------------+------------+--------------+---------------+-----------+--------+
12 rows in set (0.01 sec)