diff options
author | Magnus Blåudd <magnus.blaudd@oracle.com> | 2011-03-04 09:41:29 +0100 |
---|---|---|
committer | Magnus Blåudd <magnus.blaudd@oracle.com> | 2011-03-04 09:41:29 +0100 |
commit | 0be575b7c8a7d551e7b0ea011b715f5e808e2eab (patch) | |
tree | 91078f8e09a7d3bf446e8c6c1896bde1a0a20ad7 /mysql-test/t/tablespace.test | |
parent | d1d166875ac2eec18d15611d0d82ba49b6def288 (diff) | |
download | mariadb-git-0be575b7c8a7d551e7b0ea011b715f5e808e2eab.tar.gz |
Bug#60111 storage type for table not saved in .frm
- Add new "format section" in extra data segment with additional table and
column properties. This was originally introduced in 5.1.20 based MySQL Cluster
- Remove hardcoded STORAGE DISK for table and instead
output the real storage format used. Keep both TABLESPACE
and STORAGE inside same version guard.
- Implement default version of handler::get_tablespace_name() since tablespace
is now available in share and it's unnecessary for each handler to implement.
(the function could actually be removed totally now).
- Add test for combinations of TABLESPACE and STORAGE with CREATE TABLE
and ALTER TABLE
- Add test to show that 5.5 now can read a .frm file created by MySQL Cluster
7.0.22. Although it does not yet show the column level attributes, they are read.
Diffstat (limited to 'mysql-test/t/tablespace.test')
-rw-r--r-- | mysql-test/t/tablespace.test | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/mysql-test/t/tablespace.test b/mysql-test/t/tablespace.test new file mode 100644 index 00000000000..9f3cf6255ac --- /dev/null +++ b/mysql-test/t/tablespace.test @@ -0,0 +1,122 @@ +# +# BUG#60111 storage type for table not saved in .frm +# + +# +# Check that the table options for TABLESPACE and STORAGE +# are printed in SHOW CREATE TABLE +# + +# TABLESPACE only +CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE + STORAGE DISK +CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE + STORAGE MEMORY +CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# STORAGE MEMORY only +CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# STORAGE DISK only +CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# +# Check that the table options for TABLESPACE and STORAGE +# are kept in an ALTER +# + +# TABLESPACE only +CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM; +ALTER TABLE t1 ADD COLUMN b int; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE and STORAGE DISK +CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM; +ALTER TABLE t1 ADD COLUMN b int; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# +# Check that the table options for TABLESPACE and STORAGE +# can be changed with an ALTER +# + +# TABLESPACE only +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 TABLESPACE ts; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 TABLESPACE ts2; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# STORAGE only +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 STORAGE MEMORY; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 STORAGE DISK; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# TABLESPACE and STORAGE +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 STORAGE DISK TABLESPACE ts2; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# +# Check that it's possible to read a .frm fle created +# by MySQL Cluster 7.0(which introduced the new "format +# section) with this statement: +# +# CREATE TABLE cluster_7022_table +# ( +# a int primary key, +# b int, +# c int STORAGE DISK, +# d int STORAGE MEMORY NOT NULL, +# e int COLUMN_FORMAT DYNAMIC, +# f int COLUMN_FORMAT FIXED, +# g int COLUMN_FORMAT DEFAULT, +# h int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL, +# i int STORAGE MEMORY COLUMN_FORMAT DYNAMIC, +# j int STORAGE DISK COLUMN_FORMAT FIXED, +# k int STORAGE MEMORY COLUMN_FORMAT FIXED +# ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM; +# +# NOTE! The column level properties will not yet show up +# in SHOW CREATE TABLE of MySQL Server(although they are +# visible in .trace file) +# + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/cluster_7022_table.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/cluster_7022_table.MYI $MYSQLD_DATADIR/test/t1.MYI; + +SHOW CREATE TABLE t1; + +DROP TABLE t1; |