3948 kevin.lewis@stripped 2012-06-05
Move tests from innodb-wl5522-wl5980.test into innodb-wl5980-discard.test
and add a negative test requested by viswa. Delete innodb-wl5522-wl5980.
removed:
mysql-test/suite/innodb/r/innodb-wl5522-wl5980.result
mysql-test/suite/innodb/t/innodb-wl5522-wl5980.test
added:
mysql-test/suite/innodb/t/portability_wl5980_linux.zip
modified:
mysql-test/suite/innodb/r/innodb-wl5980-debug.result
mysql-test/suite/innodb/r/innodb-wl5980-discard.result
mysql-test/suite/innodb/t/innodb-wl5980-debug.test
mysql-test/suite/innodb/t/innodb-wl5980-discard.test
3947 kevin.lewis@stripped 2012-06-05
Full patch of 5980.
This adds a new test (innodb-wl5980-debug) that calls some
error injection points in order to get better code coverage.
added:
mysql-test/include/shutdown_mysqld.inc
mysql-test/include/start_mysqld.inc
mysql-test/r/partition_innodb_tablespace.result
mysql-test/suite/innodb/r/innodb-multiple-tablespaces.result
mysql-test/suite/innodb/r/innodb-tablespace.result
mysql-test/suite/innodb/r/innodb-wl5522-wl5980.result
mysql-test/suite/innodb/r/innodb-wl5980-debug.result
mysql-test/suite/innodb/r/innodb-wl5980-discard.result
mysql-test/suite/innodb/r/innodb-wl5980-linux.result
mysql-test/suite/innodb/t/innodb-multiple-tablespaces.test
mysql-test/suite/innodb/t/innodb-tablespace.test
mysql-test/suite/innodb/t/innodb-wl5522-wl5980.test
mysql-test/suite/innodb/t/innodb-wl5980-debug.test
mysql-test/suite/innodb/t/innodb-wl5980-discard.test
mysql-test/suite/innodb/t/innodb-wl5980-linux.test
mysql-test/suite/parts/r/partition_reorganize_innodb.result
mysql-test/suite/parts/r/partition_reorganize_myisam.result
mysql-test/suite/parts/t/partition_reorganize_innodb.test
mysql-test/suite/parts/t/partition_reorganize_myisam.test
mysql-test/t/partition_innodb_tablespace.test
modified:
include/my_base.h
mysql-test/r/mysqlshow.result
mysql-test/suite/innodb/r/innodb-alter-discard.result
mysql-test/suite/innodb/r/innodb-restart.result
mysql-test/suite/innodb/r/innodb-system-table-view.result
mysql-test/suite/innodb/r/innodb_16k.result
mysql-test/suite/innodb/r/innodb_4k.result
mysql-test/suite/innodb/r/innodb_8k.result
mysql-test/suite/innodb/r/innodb_bug60049.result
mysql-test/suite/innodb/t/innodb-alter-discard.test
mysql-test/suite/innodb/t/innodb-restart.test
mysql-test/suite/innodb/t/innodb-system-table-view.test
mysql-test/suite/innodb/t/innodb_16k.test
mysql-test/suite/innodb/t/innodb_4k.test
mysql-test/suite/innodb/t/innodb_8k.test
mysql-test/suite/parts/r/partition_basic_symlink_innodb.result
mysql-test/suite/parts/t/partition_basic_symlink_innodb.test
mysys/my_handler_errors.h
sql/ha_partition.cc
sql/ha_partition.h
sql/handler.cc
sql/sql_partition.cc
sql/sql_partition.h
sql/sql_table.cc
storage/innobase/dict/dict0boot.cc
storage/innobase/dict/dict0crea.cc
storage/innobase/dict/dict0dict.cc
storage/innobase/dict/dict0load.cc
storage/innobase/fil/fil0fil.cc
storage/innobase/fts/fts0fts.cc
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/i_s.cc
storage/innobase/handler/i_s.h
storage/innobase/include/db0err.h
storage/innobase/include/dict0boot.h
storage/innobase/include/dict0crea.h
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0dict.ic
storage/innobase/include/dict0load.h
storage/innobase/include/dict0mem.h
storage/innobase/include/fil0fil.h
storage/innobase/include/fsp0fsp.h
storage/innobase/include/fsp0fsp.ic
storage/innobase/include/os0file.h
storage/innobase/include/row0merge.h
storage/innobase/include/row0mysql.h
storage/innobase/include/srv0start.h
storage/innobase/lock/lock0lock.cc
storage/innobase/os/os0file.cc
storage/innobase/pars/pars0pars.cc
storage/innobase/row/row0import.cc
storage/innobase/row/row0merge.cc
storage/innobase/row/row0mysql.cc
storage/innobase/row/row0quiesce.cc
storage/innobase/srv/srv0start.cc
storage/innobase/trx/trx0rec.cc
storage/innobase/ut/ut0ut.cc
=== removed file 'mysql-test/suite/innodb/r/innodb-wl5522-wl5980.result'
--- a/mysql-test/suite/innodb/r/innodb-wl5522-wl5980.result revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/r/innodb-wl5522-wl5980.result 1970-01-01 00:00:00 +0000
@@ -1,188 +0,0 @@
-#
-# This test shows DISCARD/IMPORT of a remote tablespace.
-#
-DROP TABLE IF EXISTS t1;
-SET default_storage_engine=InnoDB;
-SET GLOBAL innodb_file_per_table=ON;
-#
-# CREATE TABLE ... DATA DIRECTORY
-# Innodb does not support INDEX DIRECTORY.
-#
-#
-# try remote tablespace with wl5522 change(innodb transportable tablespace)
-# Create innodb table at alternate path , DISCARD its tablespace from
-# alternate path , copy back .ibd file and import the tablspace (ibd) file
-#
-# Create the tablespace in MYSQL_TMP_DIR/alt_dir
-# InnoDB will create the sub-directories if needed.
-CREATE TABLE t1 (a int KEY, b text) ENGINE = Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
-SHOW WARNINGS;
-Level Code Message
-INSERT INTO t1 VALUES (1, "Create the tablespace");
-SELECT * FROM t1;
-a b
-1 Create the tablespace
-# Check if tablespace file exists where we specified in DATA DIRECTORY
-# Check if link file exists in MYSQLD_DATADIR
-# Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
-SHOW CREATE TABLE t1;
-Table Create Table
-t1 CREATE TABLE `t1` (
- `a` int(11) NOT NULL,
- `b` text,
- PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
-# Lock table to discard tablespace
-FLUSH TABLES t1 FOR EXPORT;
-"-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
-t1.cfg
-t1.ibd
-"-- files in MYSQLD_DATADIR/test/ --"
-t1.frm
-t1.isl
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-1
-# Backup the cfg and ibd files from MYSQL_TMP_DIR/alt_dir/test/ to MYSQL_TMP_DIR/
-"-- files in MYSQL_TMP_DIR/alt_dir/ --"
-t1.cfg.bak
-t1.ibd.bak
-test
-"-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
-t1.cfg
-t1.ibd
-"-- files in MYSQLD_DATADIR/test/ --"
-t1.frm
-t1.isl
-UNLOCK TABLES;
-INSERT INTO t1 VALUES (2,'case with transportable tab;espace'),
-(3,'ibd/ibt files created at alternate location'),
-(4,'cfg/frm files will be at datadir and not at alternate location');
-START TRANSACTION;
-INSERT INTO t1 VALUES (12,'case with transportable tablespace');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES (13,'ibd/ibt files created at alternate location'),
-(14,'cfg/frm files will be at datadir and not at alternate location');
-ROLLBACK;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-5
-SELECT * FROM t1;
-a b
-1 Create the tablespace
-2 case with transportable tab;espace
-3 ibd/ibt files created at alternate location
-4 cfg/frm files will be at datadir and not at alternate location
-12 case with transportable tablespace
-ALTER TABLE t1 DROP PRIMARY KEY;
-ALTER TABLE t1 ADD COLUMN col3 VARCHAR(50) DEFAULT NULL;
-INSERT INTO t1(a,b) VALUES (2,'case with transportable tab;espace');
-SELECT * FROM t1;
-a b col3
-1 Create the tablespace NULL
-2 case with transportable tab;espace NULL
-3 ibd/ibt files created at alternate location NULL
-4 cfg/frm files will be at datadir and not at alternate location NULL
-12 case with transportable tablespace NULL
-2 case with transportable tab;espace NULL
-DROP TABLE t1;
-CREATE TABLE t1 (a int KEY, b text) ENGINE = Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
-ALTER TABLE t1 DISCARD TABLESPACE;
-SELECT * FROM t1;
-ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
-"-- files in MYSQL_TMP_DIR/alt_dir/ --"
-t1.cfg.bak
-t1.ibd.bak
-test
-"-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
-t1.ibt
-"-- files in MYSQLD_DATADIR/test/ --"
-t1.frm
-t1.isl
-# Restore the backup cfg and ibd files from MYSQL_TMP_DIR/ to MYSQL_TMP_DIR/alt_dir/test/
-"-- files in MYSQL_TMP_DIR/alt_dir//test/ --"
-t1.cfg
-t1.ibd
-t1.ibt
-ALTER TABLE t1 IMPORT TABLESPACE;
-CHECK TABLE t1;
-Table Op Msg_type Msg_text
-test.t1 check status OK
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-1
-SELECT * FROM t1;
-a b
-1 Create the tablespace
-INSERT INTO t1 VALUES (2,'case with transportable tab;espace'),
-(3,'ibd/ibt files created at alternate location'),
-(4,'cfg/frm files will be at datadir and not at alternate location');
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-4
-SELECT * FROM t1;
-a b
-1 Create the tablespace
-2 case with transportable tab;espace
-3 ibd/ibt files created at alternate location
-4 cfg/frm files will be at datadir and not at alternate location
-START TRANSACTION;
-INSERT INTO t1 VALUES (12,'case with transportable tab;espace');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES (13,'ibd/ibt files created at alternate location'),
-(14,'cfg/frm files will be at datadir and not at alternate location');
-ROLLBACK;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-5
-SELECT * FROM t1;
-a b
-1 Create the tablespace
-2 case with transportable tab;espace
-3 ibd/ibt files created at alternate location
-4 cfg/frm files will be at datadir and not at alternate location
-12 case with transportable tab;espace
-ALTER TABLE t1 DROP PRIMARY KEY;
-ALTER TABLE t1 ADD COLUMN col3 VARCHAR(50) DEFAULT NULL;
-INSERT INTO t1(a,b) VALUES (2,'case with transportable tab;espace');
-SELECT * FROM t1;
-a b col3
-1 Create the tablespace NULL
-2 case with transportable tab;espace NULL
-3 ibd/ibt files created at alternate location NULL
-4 cfg/frm files will be at datadir and not at alternate location NULL
-12 case with transportable tab;espace NULL
-2 case with transportable tab;espace NULL
-# Show that the new system tables have this table in them correctly
-SELECT name,n_cols,file_format,row_format
-FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
-name n_cols file_format row_format
-test/t1 6 Antelope Compact
-SELECT name,file_format,row_format
-FROM information_schema.innodb_sys_tablespaces;
-name file_format row_format
-test/t1 Antelope Compact or Redundant
-SELECT path FROM information_schema.innodb_sys_datafiles;
-path
-MYSQL_TMP_DIR/alt_dir/test/t1.ibd
-# Show that the system tables are updated on drop table
-DROP TABLE t1;
-SELECT name,n_cols,file_format,row_format
-FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
-name n_cols file_format row_format
-SELECT name,file_format,row_format
-FROM information_schema.innodb_sys_tablespaces;
-name file_format row_format
-SELECT path FROM information_schema.innodb_sys_datafiles;
-path
-#
-# Cleanup
-#
-"-- files in MYSQL_TMP_DIR/alt_dir/ --"
-t1.cfg.bak
-t1.ibd.bak
-test
-"-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
-"-- files in MYSQLD_DATADIR/test/ --"
=== modified file 'mysql-test/suite/innodb/r/innodb-wl5980-debug.result'
--- a/mysql-test/suite/innodb/r/innodb-wl5980-debug.result revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/r/innodb-wl5980-debug.result revid:kevin.lewis@stripped
@@ -1,6 +1,6 @@
SET GLOBAL innodb_file_per_table=ON;
#
-# WL5980 Remote tablespace Debug error injection tests.
+# WL5980 Remote tablespace debug error injection tests.
#
CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ;
INSERT INTO t1 VALUES (1, "tablespace");
=== modified file 'mysql-test/suite/innodb/r/innodb-wl5980-discard.result'
--- a/mysql-test/suite/innodb/r/innodb-wl5980-discard.result revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/r/innodb-wl5980-discard.result revid:kevin.lewis@stripped
@@ -1,52 +1,342 @@
+#
+# This test shows DISCARD/IMPORT of a remote tablespace.
+#
+SET default_storage_engine=InnoDB;
SET GLOBAL innodb_file_per_table=ON;
+DROP TABLE IF EXISTS t1;
#
-# TABLESPACE related tests.
+# CREATE TABLE ... DATA DIRECTORY
+# combined with WL#5522 - Transportable Tablespace
+# Create the tablespace in MYSQL_TMP_DIR/alt_dir
+# InnoDB will create the sub-directories if needed.
+# Test that DISCARD and IMPORT work correctly.
#
-CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ;
-# insert a record
-INSERT INTO t1 VALUES (1, "tablespace");
-# check the record
+CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
+INSERT INTO t1 VALUES (1, "Create the tablespace");
SELECT * FROM t1;
a b
-1 tablespace
-### files in MYSQLD_DATADIR/test
+1 Create the tablespace
+### files in MYSQL_DATA_DIR/test
t1.frm
t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
t1.ibd
+#
+# Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
+#
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ `b` text,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
+#
+# Backup the cfg and ibd files.
+#
FLUSH TABLES t1 FOR EXPORT;
-# Backup *.ibd and *.cfg files
-### files in MYSQLD_DATADIR/test
+SELECT * FROM t1;
+a b
+1 Create the tablespace
+UNLOCK TABLES;
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.ibd
+t1.ibd.bak
+#
+# Do some DDL and DML.
+#
+INSERT INTO t1 VALUES (2,'Remote table has been FLUSHed and UNLOCKed');
+START TRANSACTION;
+INSERT INTO t1 VALUES (12,'Transactional record inserted');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (13,'Rollback this transactional record');
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+3
+SELECT * FROM t1;
+a b
+1 Create the tablespace
+2 Remote table has been FLUSHed and UNLOCKed
+12 Transactional record inserted
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
+INSERT INTO t1(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
+SELECT * FROM t1;
+a b c
+1 Create the tablespace NULL
+2 Remote table has been FLUSHed and UNLOCKed NULL
+12 Transactional record inserted NULL
+2 Duplicate value since primary key has been dropped third column added
+#
+# Make a second backup of the cfg and ibd files.
+#
+FLUSH TABLES t1 FOR EXPORT;
+SELECT * FROM t1;
+a b c
+1 Create the tablespace NULL
+2 Remote table has been FLUSHed and UNLOCKed NULL
+12 Transactional record inserted NULL
+2 Duplicate value since primary key has been dropped third column added
+UNLOCK TABLES;
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
+#
+# DROP the table and make sure all files except the backups are gone.
+#
+DROP TABLE t1;
+### files in MYSQL_DATA_DIR/test
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
+#
+# CREATE the table again.
+#
+CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
+INSERT INTO t1 VALUES (1, "Create the tablespace a second time");
+SELECT * FROM t1;
+a b
+1 Create the tablespace a second time
+#
+# DISCARD existing tablespace so backed-up .ibd which can be imported/restored
+#
+ALTER TABLE t1 DISCARD TABLESPACE;
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+### files in MYSQL_DATA_DIR/test
t1.frm
t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
+t1.ibt
+#
+# Restore the second backup of cfg and ibd files.
+#
+"### files in MYSQL_TMP_DIR/alt_dir/test"
t1.cfg
-t1.cfg.bk
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
+t1.ibt
+#
+# Try to Import the second backup. These backups have extra DDL and
+# do not match the current frm file.
+#
+ALTER TABLE t1 IMPORT TABLESPACE;
+ERROR HY000: InnoDB: Schema mismatch (Number of columns don't match, table has 5 columns but the tablespace meta-data file has 6 columns)
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error InnoDB: Tablespace has been discarded for table 't1'
+test.t1 check error Corrupt
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
+t1.ibt
+#
+# Restore the first backup of cfg and ibd files.
+#
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
+t1.ibt
+#
+# Import the tablespace and do some DDL and DML.
+#
+ALTER TABLE t1 IMPORT TABLESPACE;
+Warnings:
+Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
+t1.ibt
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+1
+SELECT * FROM t1;
+a b
+1 Create the tablespace
+INSERT INTO t1 VALUES (2,'Inserted record after IMPORT');
+SELECT * FROM t1;
+a b
+1 Create the tablespace
+2 Inserted record after IMPORT
+START TRANSACTION;
+INSERT INTO t1 VALUES (12,'Transactional record inserted');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (13,'Rollback this transactional record');
+ROLLBACK;
+SELECT * FROM t1;
+a b
+1 Create the tablespace
+2 Inserted record after IMPORT
+12 Transactional record inserted
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
+INSERT INTO t1(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
+SELECT * FROM t1;
+a b c
+1 Create the tablespace NULL
+2 Inserted record after IMPORT NULL
+12 Transactional record inserted NULL
+2 Duplicate value since primary key has been dropped third column added
+#
+# Show that the system tables have this table in them correctly.
+#
+SELECT name,n_cols,file_format,row_format
+FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+name n_cols file_format row_format
+test/t1 6 Antelope Compact
+SELECT name,file_format,row_format
+FROM information_schema.innodb_sys_tablespaces;
+name file_format row_format
+test/t1 Antelope Compact or Redundant
+SELECT path FROM information_schema.innodb_sys_datafiles;
+path
+MYSQL_TMP_DIR/alt_dir/test/t1.ibd
+#
+# Drop the imported table and show that the system tables are updated.
+#
+DROP TABLE t1;
+SELECT name,n_cols,file_format,row_format
+FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+name n_cols file_format row_format
+SELECT name,file_format,row_format
+FROM information_schema.innodb_sys_tablespaces;
+name file_format row_format
+SELECT path FROM information_schema.innodb_sys_datafiles;
+path
+### files in MYSQL_DATA_DIR/test
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
+#
+# CREATE the table a third time.
+#
+CREATE TABLE t1 (a int KEY, b text) DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir';
+INSERT INTO t1 VALUES (1, "Create the tablespace a third time");
+SELECT * FROM t1;
+a b
+1 Create the tablespace a third time
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
t1.ibd
-t1.ibd.bk
-# unlock table after .ibd/.cfg files are backed-up for import
+t1.ibd.bak
+t1.ibd.bak2
+#
+# Restart the server
+# This test makes sure that you can still execute the FLUSH TABLES command
+# after restarting the server and the tablespace can still be found.
+#
+SET GLOBAL innodb_file_per_table=ON;
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
+SELECT * FROM t1;
+a b
+1 Create the tablespace a third time
+FLUSH TABLES t1 FOR EXPORT;
+SELECT * FROM t1;
+a b
+1 Create the tablespace a third time
UNLOCK TABLES;
+#
+# Restart the server again. This test makes sure that you can
+# still DISCARD a remote table after restarting the server.
+#
+SET GLOBAL innodb_file_per_table=ON;
+SELECT * FROM t1;
+a b
+1 Create the tablespace a third time
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
ALTER TABLE t1 DISCARD TABLESPACE;
-### files in MYSQLD_DATADIR/test
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+### files in MYSQL_DATA_DIR/test
t1.frm
t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
-t1.cfg.bk
-t1.ibd.bk
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
t1.ibt
-# Restore the backup of *.ibd and *.cfg files
-### files in MYSQLD_DATADIR/test
+#
+# Restore the backup of *.ibd and *.cfg files
+#
+### files in MYSQL_DATA_DIR/test
t1.frm
t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
t1.cfg
+t1.cfg.bak
+t1.cfg.bak2
t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
t1.ibt
+#
+# Import the tablespace and check it out.
+#
ALTER TABLE t1 IMPORT TABLESPACE;
-#check the table with DML operation
SELECT * FROM t1;
a b
-1 tablespace
+1 Create the tablespace
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -54,43 +344,107 @@ t1 CREATE TABLE `t1` (
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
-#
-# Restart the server
-#
-USE test;
-SET GLOBAL innodb_file_per_table=ON;
-# here server crash occurs
-FLUSH TABLES t1 FOR EXPORT;
-# Backup *.ibd and *.cfg files
-# Check backup files are existing
+### files in MYSQL_DATA_DIR/test
+t1.frm
+t1.isl
+### files in MYSQL_TMP_DIR/alt_dir/test
t1.cfg
-t1.cfg.bk
+t1.cfg.bak
+t1.cfg.bak2
t1.ibd
-t1.ibd.bk
+t1.ibd.bak
+t1.ibd.bak2
t1.ibt
-# unlock table after .ibd/.cfg files are backed-up for import
-UNLOCK TABLES;
+#
+# DISCARD the tablespace again
+#
ALTER TABLE t1 DISCARD TABLESPACE;
-### files in MYSQLD_DATADIR/test
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+### files in MYSQL_DATA_DIR/test
t1.frm
t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
-t1.cfg.bk
-t1.ibd.bk
+t1.cfg
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
t1.ibt
-# Restore the backup of *.ibd and *.cfg files
-### files in MYSQLD_DATADIR/test
+#
+# Restart the engine while the tablespace is in the discarded state
+#
+SET GLOBAL innodb_file_per_table=ON;
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error InnoDB: Tablespace has been discarded for table 't1'
+test.t1 check error Corrupt
+#
+# Reloacte this discarded file to the default directory
+# instead of the remote directory it was discarded from.
+# Put cfg, ibt, and idb files into the default directory.
+# Delete the isl file and the remote cfg and ibt files.
+# Restart the engine again.
+# The tablespace is still in the discarded state.
+#
+### files in MYSQL_DATA_DIR/test
+t1.cfg
+t1.frm
+t1.ibd
+t1.ibt
+### files in MYSQL_TMP_DIR/alt_dir/test
+t1.cfg.bak
+t1.cfg.bak2
+t1.ibd.bak
+t1.ibd.bak2
+# Restarting ...
+SET GLOBAL innodb_file_per_table=ON;
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error InnoDB: Tablespace has been discarded for table 't1'
+test.t1 check error Corrupt
+#
+# Try to import the tablespace. It can only be imported from
+# the location it was discarded from.
+# The error message for 1810 (IO_READ_ERROR) refers to a local path
+# so do not display it.
+#
+ALTER TABLE t1 IMPORT TABLESPACE;
+SELECT * FROM t1;
+ERROR HY000: InnoDB: Tablespace has been discarded for table 't1'
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check Error InnoDB: Tablespace has been discarded for table 't1'
+test.t1 check error Corrupt
+#
+# Restore the ibd, ibt and cfg files to the remote directory.
+# Delete the ibd, ibt and cfg files from the default directory.
+# The isl file is missing, but is no longer needed since the
+# remote location is in the data dictionary.
+# Import the tablespace and check it out.
+#
+### files in MYSQL_DATA_DIR/test
t1.frm
-t1.isl
### files in MYSQL_TMP_DIR/alt_dir/test
t1.cfg
+t1.cfg.bak
+t1.cfg.bak2
t1.ibd
+t1.ibd.bak
+t1.ibd.bak2
t1.ibt
ALTER TABLE t1 IMPORT TABLESPACE;
-#check the table with DML operation
+Warnings:
+Warning 1814 InnoDB: Tablespace has been discarded for table 't1'
+INSERT INTO t1 VALUES (2, "Insert this record after IMPORT");
SELECT * FROM t1;
a b
-1 tablespace
+1 Create the tablespace
+2 Insert this record after IMPORT
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -98,9 +452,23 @@ t1 CREATE TABLE `t1` (
`b` text,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir/'
-#check the table with DML operation
-DELETE FROM t1;
+#
+# Show that the system tables have this table in them correctly.
+#
+SELECT name,n_cols,file_format,row_format
+FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+name n_cols file_format row_format
+test/t1 5 Antelope Compact
+SELECT name,file_format,row_format
+FROM information_schema.innodb_sys_tablespaces;
+name file_format row_format
+test/t1 Antelope Compact or Redundant
+SELECT path FROM information_schema.innodb_sys_datafiles;
+path
+MYSQL_TMP_DIR/alt_dir/test/t1.ibd
#
# Cleanup
#
DROP TABLE t1;
+### files in MYSQL_DATA_DIR/test
+### files in MYSQL_TMP_DIR/alt_dir/test
=== removed file 'mysql-test/suite/innodb/t/innodb-wl5522-wl5980.test'
--- a/mysql-test/suite/innodb/t/innodb-wl5522-wl5980.test revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/t/innodb-wl5522-wl5980.test 1970-01-01 00:00:00 +0000
@@ -1,175 +0,0 @@
---echo #
---echo # This test shows DISCARD/IMPORT of a remote tablespace.
---echo #
-
-# Not supported in embedded
---source include/not_embedded.inc
-
--- source include/have_innodb.inc
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-SET default_storage_engine=InnoDB;
-# Set up some variables
-LET $MYSQLD_DATADIR = `select @@datadir`;
-LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
-LET $index_directory_clause = INDEX DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
-
-# These values can change during the test
-LET $innodb_file_format_orig=`select @@innodb_file_format`;
-LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
-LET $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
-
-SET GLOBAL innodb_file_per_table=ON;
-
---echo #
---echo # CREATE TABLE ... DATA DIRECTORY
---echo # Innodb does not support INDEX DIRECTORY.
---echo #
---echo #
---echo # try remote tablespace with wl5522 change(innodb transportable tablespace)
---echo # Create innodb table at alternate path , DISCARD its tablespace from
---echo # alternate path , copy back .ibd file and import the tablspace (ibd) file
---echo #
-
-
---echo # Create the tablespace in MYSQL_TMP_DIR/alt_dir
---echo # InnoDB will create the sub-directories if needed.
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval CREATE TABLE t1 (a int KEY, b text) ENGINE = Innodb $data_directory_clause;
-SHOW WARNINGS;
-INSERT INTO t1 VALUES (1, "Create the tablespace");
-SELECT * FROM t1;
---echo # Check if tablespace file exists where we specified in DATA DIRECTORY
---file_exists $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
---echo # Check if link file exists in MYSQLD_DATADIR
---file_exists $MYSQLD_DATADIR/test/t1.isl
---echo # Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-SHOW CREATE TABLE t1;
---echo # Lock table to discard tablespace
-FLUSH TABLES t1 FOR EXPORT;
---echo "-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/test/
---echo "-- files in MYSQLD_DATADIR/test/ --"
---list_files $MYSQLD_DATADIR/test/
-SELECT COUNT(*) FROM t1;
---echo # Backup the cfg and ibd files from MYSQL_TMP_DIR/alt_dir/test/ to MYSQL_TMP_DIR/
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/t1.cfg.bak
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/t1.ibd.bak
-
---echo "-- files in MYSQL_TMP_DIR/alt_dir/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/
---echo "-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/test/
---echo "-- files in MYSQLD_DATADIR/test/ --"
---list_files $MYSQLD_DATADIR/test/
-# unlock table after .ibd/.cfg files are backed-up for import
-UNLOCK TABLES;
-# check if records can be inserted
-INSERT INTO t1 VALUES (2,'case with transportable tab;espace'),
-(3,'ibd/ibt files created at alternate location'),
-(4,'cfg/frm files will be at datadir and not at alternate location');
-START TRANSACTION;
-INSERT INTO t1 VALUES (12,'case with transportable tablespace');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES (13,'ibd/ibt files created at alternate location'),
-(14,'cfg/frm files will be at datadir and not at alternate location');
-ROLLBACK;
-SELECT COUNT(*) FROM t1;
-SELECT * FROM t1;
-ALTER TABLE t1 DROP PRIMARY KEY;
-ALTER TABLE t1 ADD COLUMN col3 VARCHAR(50) DEFAULT NULL;
-INSERT INTO t1(a,b) VALUES (2,'case with transportable tab;espace');
-SELECT * FROM t1;
-
-DROP TABLE t1;
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval CREATE TABLE t1 (a int KEY, b text) ENGINE = Innodb $data_directory_clause;
-# DISCARD existing tablespace so backed-up .ibd which can be imported/restored
-ALTER TABLE t1 DISCARD TABLESPACE;
---error 1814
-SELECT * FROM t1;
-
---echo "-- files in MYSQL_TMP_DIR/alt_dir/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/
---echo "-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/test/
---echo "-- files in MYSQLD_DATADIR/test/ --"
---list_files $MYSQLD_DATADIR/test/
-
---echo # Restore the backup cfg and ibd files from MYSQL_TMP_DIR/ to MYSQL_TMP_DIR/alt_dir/test/
---copy_file $MYSQL_TMP_DIR/alt_dir/t1.cfg.bak $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
---copy_file $MYSQL_TMP_DIR/alt_dir/t1.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
-
---echo "-- files in MYSQL_TMP_DIR/alt_dir//test/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/test/
-
-ALTER TABLE t1 IMPORT TABLESPACE;
-CHECK TABLE t1;
-SELECT COUNT(*) FROM t1;
-SELECT * FROM t1;
-INSERT INTO t1 VALUES (2,'case with transportable tab;espace'),
-(3,'ibd/ibt files created at alternate location'),
-(4,'cfg/frm files will be at datadir and not at alternate location');
-SELECT COUNT(*) FROM t1;
-SELECT * FROM t1;
-START TRANSACTION;
-INSERT INTO t1 VALUES (12,'case with transportable tab;espace');
-COMMIT;
-START TRANSACTION;
-INSERT INTO t1 VALUES (13,'ibd/ibt files created at alternate location'),
-(14,'cfg/frm files will be at datadir and not at alternate location');
-ROLLBACK;
-SELECT COUNT(*) FROM t1;
-SELECT * FROM t1;
-ALTER TABLE t1 DROP PRIMARY KEY;
-ALTER TABLE t1 ADD COLUMN col3 VARCHAR(50) DEFAULT NULL;
-INSERT INTO t1(a,b) VALUES (2,'case with transportable tab;espace');
-SELECT * FROM t1;
-
---echo # Show that the new system tables have this table in them correctly
-SELECT name,n_cols,file_format,row_format
- FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
-SELECT name,file_format,row_format
- FROM information_schema.innodb_sys_tablespaces;
---replace_regex /emp#P#/emp#p#/
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-SELECT path FROM information_schema.innodb_sys_datafiles;
-
---echo # Show that the system tables are updated on drop table
-DROP TABLE t1;
-SELECT name,n_cols,file_format,row_format
- FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
-SELECT name,file_format,row_format
- FROM information_schema.innodb_sys_tablespaces;
-SELECT path FROM information_schema.innodb_sys_datafiles;
-
---echo #
---echo # Cleanup
---echo #
-
---echo "-- files in MYSQL_TMP_DIR/alt_dir/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/
---echo "-- files in MYSQL_TMP_DIR/alt_dir/test/ --"
---list_files $MYSQL_TMP_DIR/alt_dir/test/
---echo "-- files in MYSQLD_DATADIR/test/ --"
---list_files $MYSQLD_DATADIR/test/
-
---remove_file $MYSQL_TMP_DIR/alt_dir/t1.cfg.bak
---remove_file $MYSQL_TMP_DIR/alt_dir/t1.ibd.bak
---rmdir $MYSQL_TMP_DIR/alt_dir/test
---rmdir $MYSQL_TMP_DIR/alt_dir
-
---disable_query_log
-EVAL SET GLOBAL innodb_file_format=$innodb_file_format_orig;
-EVAL SET GLOBAL innodb_file_per_table=$innodb_file_per_table_orig;
-EVAL SET SESSION innodb_strict_mode=$innodb_strict_mode_orig;
---enable_query_log
-
-
-
-
=== modified file 'mysql-test/suite/innodb/t/innodb-wl5980-debug.test'
--- a/mysql-test/suite/innodb/t/innodb-wl5980-debug.test revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/t/innodb-wl5980-debug.test revid:kevin.lewis@stripped
@@ -15,21 +15,22 @@
--disable_query_log
# These values can change during the test
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+
+# These messages are expected in the log
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
---enable_query_log
+# Set up some variables
+LET $MYSQL_DATA_DIR = `select @@datadir`;
+LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
+--enable_query_log
SET GLOBAL innodb_file_per_table=ON;
--echo #
---echo # WL5980 Remote tablespace Debug error injection tests.
+--echo # WL5980 Remote tablespace debug error injection tests.
--echo #
-# Set up some variables
-LET $MYSQL_DATA_DIR = `select @@datadir`;
-LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
-
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
INSERT INTO t1 VALUES (1, "tablespace");
=== modified file 'mysql-test/suite/innodb/t/innodb-wl5980-discard.test'
--- a/mysql-test/suite/innodb/t/innodb-wl5980-discard.test revid:kevin.lewis@stripped
+++ b/mysql-test/suite/innodb/t/innodb-wl5980-discard.test revid:kevin.lewis@stripped
@@ -1,143 +1,383 @@
-#
-# This testcase is to check the server crash due to
-# NULL pointer exception arises after restarting the
-# server and then execute FLUSH TABLES command.
-#
+--echo #
+--echo # This test shows DISCARD/IMPORT of a remote tablespace.
+--echo #
+
+# Not supported in embedded
+--source include/not_embedded.inc
---source include/have_innodb.inc
+-- source include/have_innodb.inc
--disable_query_log
# These values can change during the test
-LET $innodb_file_format_orig=`select @@innodb_file_format`;
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+
+# This warning is expected in the log
+call mtr.add_suppression("tablespace is set as discarded");
+
+# Set up some variables
+LET $MYSQL_DATA_DIR = `select @@datadir`;
+LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
--enable_query_log
+SET default_storage_engine=InnoDB;
+
SET GLOBAL innodb_file_per_table=ON;
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
--echo #
---echo # TABLESPACE related tests.
+--echo # CREATE TABLE ... DATA DIRECTORY
+--echo # combined with WL#5522 - Transportable Tablespace
+--echo # Create the tablespace in MYSQL_TMP_DIR/alt_dir
+--echo # InnoDB will create the sub-directories if needed.
+--echo # Test that DISCARD and IMPORT work correctly.
--echo #
-# Set up some variables
-LET $MYSQLD_DATADIR = `select @@datadir`;
-LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (a int KEY, b text) $data_directory_clause;
+INSERT INTO t1 VALUES (1, "Create the tablespace");
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+--echo #
+--echo # Check that DATA DIRECTORY shows up in the SHOW CREATE TABLE results.
+--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
+SHOW CREATE TABLE t1;
---echo # insert a record
-INSERT INTO t1 VALUES (1, "tablespace");
---echo # check the record
+--echo #
+--echo # Backup the cfg and ibd files.
+--echo #
+FLUSH TABLES t1 FOR EXPORT;
SELECT * FROM t1;
-
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak
+UNLOCK TABLES;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
-FLUSH TABLES t1 FOR EXPORT;
+--echo #
+--echo # Do some DDL and DML.
+--echo #
+INSERT INTO t1 VALUES (2,'Remote table has been FLUSHed and UNLOCKed');
+START TRANSACTION;
+INSERT INTO t1 VALUES (12,'Transactional record inserted');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (13,'Rollback this transactional record');
+ROLLBACK;
+SELECT COUNT(*) FROM t1;
+SELECT * FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
+INSERT INTO t1(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
+SELECT * FROM t1;
---echo # Backup *.ibd and *.cfg files
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk
+--echo #
+--echo # Make a second backup of the cfg and ibd files.
+--echo #
+FLUSH TABLES t1 FOR EXPORT;
+SELECT * FROM t1;
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak2
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak2
+UNLOCK TABLES;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--echo #
+--echo # DROP the table and make sure all files except the backups are gone.
+--echo #
+DROP TABLE t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo # unlock table after .ibd/.cfg files are backed-up for import
-UNLOCK TABLES;
+--echo #
+--echo # CREATE the table again.
+--echo #
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (a int KEY, b text) $data_directory_clause;
+INSERT INTO t1 VALUES (1, "Create the tablespace a second time");
+SELECT * FROM t1;
+--echo #
+--echo # DISCARD existing tablespace so backed-up .ibd which can be imported/restored
+--echo #
ALTER TABLE t1 DISCARD TABLESPACE;
-
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo # Restore the backup of *.ibd and *.cfg files
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
---remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk
---remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk
+--echo #
+--echo # Restore the second backup of cfg and ibd files.
+--echo #
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak2 $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak2 $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
+--echo "### files in MYSQL_TMP_DIR/alt_dir/test"
+--list_files $MYSQL_TMP_DIR/alt_dir/test/
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--echo #
+--echo # Try to Import the second backup. These backups have extra DDL and
+--echo # do not match the current frm file.
+--echo #
+--error ER_TABLE_SCHEMA_MISMATCH
+ALTER TABLE t1 IMPORT TABLESPACE;
+CHECK TABLE t1;
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
-ALTER TABLE t1 IMPORT TABLESPACE;
+--echo #
+--echo # Restore the first backup of cfg and ibd files.
+--echo #
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo #check the table with DML operation
+--echo #
+--echo # Import the tablespace and do some DDL and DML.
+--echo #
+ALTER TABLE t1 IMPORT TABLESPACE;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+CHECK TABLE t1;
+SELECT COUNT(*) FROM t1;
+SELECT * FROM t1;
+INSERT INTO t1 VALUES (2,'Inserted record after IMPORT');
+SELECT * FROM t1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (12,'Transactional record inserted');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES (13,'Rollback this transactional record');
+ROLLBACK;
+SELECT * FROM t1;
+ALTER TABLE t1 DROP PRIMARY KEY;
+ALTER TABLE t1 ADD COLUMN c VARCHAR(50) DEFAULT NULL;
+INSERT INTO t1(a,b,c) VALUES (2,'Duplicate value since primary key has been dropped','third column added');
SELECT * FROM t1;
+--echo #
+--echo # Show that the system tables have this table in them correctly.
+--echo #
+SELECT name,n_cols,file_format,row_format
+ FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+SELECT name,file_format,row_format
+ FROM information_schema.innodb_sys_tablespaces;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
-SHOW CREATE TABLE t1;
+SELECT path FROM information_schema.innodb_sys_datafiles;
--echo #
---echo # Restart the server
+--echo # Drop the imported table and show that the system tables are updated.
--echo #
---source include/restart_mysqld.inc
+DROP TABLE t1;
+SELECT name,n_cols,file_format,row_format
+ FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+SELECT name,file_format,row_format
+ FROM information_schema.innodb_sys_tablespaces;
+SELECT path FROM information_schema.innodb_sys_datafiles;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
-USE test;
+--echo #
+--echo # CREATE the table a third time.
+--echo #
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t1 (a int KEY, b text) $data_directory_clause;
+INSERT INTO t1 VALUES (1, "Create the tablespace a third time");
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+--echo #
+--echo # Restart the server
+--echo # This test makes sure that you can still execute the FLUSH TABLES command
+--echo # after restarting the server and the tablespace can still be found.
+--echo #
+--source include/restart_mysqld.inc
SET GLOBAL innodb_file_per_table=ON;
-
---echo # here server crash occurs
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
+SELECT * FROM t1;
+UNLOCK TABLES;
---echo # Backup *.ibd and *.cfg files
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk
+--echo #
+--echo # Restart the server again. This test makes sure that you can
+--echo # still DISCARD a remote table after restarting the server.
+--echo #
+--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_per_table=ON;
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+ALTER TABLE t1 DISCARD TABLESPACE;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo # Check backup files are existing
+--echo #
+--echo # Restore the backup of *.ibd and *.cfg files
+--echo #
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo # unlock table after .ibd/.cfg files are backed-up for import
-UNLOCK TABLES;
+--echo #
+--echo # Import the tablespace and check it out.
+--echo #
+ALTER TABLE t1 IMPORT TABLESPACE;
+SELECT * FROM t1;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+--echo #
+--echo # DISCARD the tablespace again
+--echo #
ALTER TABLE t1 DISCARD TABLESPACE;
-
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
---echo # Restore the backup of *.ibd and *.cfg files
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
---copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
---remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bk
---remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bk
+--echo #
+--echo # Restart the engine while the tablespace is in the discarded state
+--echo #
+--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_per_table=ON;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+CHECK TABLE t1;
---echo ### files in MYSQLD_DATADIR/test
---list_files $MYSQLD_DATADIR/test
+--echo #
+--echo # Reloacte this discarded file to the default directory
+--echo # instead of the remote directory it was discarded from.
+--echo # Put cfg, ibt, and idb files into the default directory.
+--echo # Delete the isl file and the remote cfg and ibt files.
+--echo # Restart the engine again.
+--echo # The tablespace is still in the discarded state.
+--echo #
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak $MYSQL_DATA_DIR/test/t1.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak $MYSQL_DATA_DIR/test/t1.cfg
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibt $MYSQL_DATA_DIR/test/t1.ibt
+--remove_file $MYSQL_DATA_DIR/test/t1.isl
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibt
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
--echo ### files in MYSQL_TMP_DIR/alt_dir/test
--list_files $MYSQL_TMP_DIR/alt_dir/test
+--echo # Restarting ...
+--source include/restart_mysqld.inc
+SET GLOBAL innodb_file_per_table=ON;
+--error ER_TABLESPACE_DISCARDED
+SELECT * FROM t1;
+CHECK TABLE t1;
+--echo #
+--echo # Try to import the tablespace. It can only be imported from
+--echo # the location it was discarded from.
+--echo # The error message for 1810 (IO_READ_ERROR) refers to a local path
+--echo # so do not display it.
+--echo #
+--disable_result_log
+--error ER_IO_READ_ERROR
ALTER TABLE t1 IMPORT TABLESPACE;
-
---echo #check the table with DML operation
+--enable_result_log
+--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
+CHECK TABLE t1;
+--echo #
+--echo # Restore the ibd, ibt and cfg files to the remote directory.
+--echo # Delete the ibd, ibt and cfg files from the default directory.
+--echo # The isl file is missing, but is no longer needed since the
+--echo # remote location is in the data dictionary.
+--echo # Import the tablespace and check it out.
+--echo #
+--copy_file $MYSQL_DATA_DIR/test/t1.ibd $MYSQL_TMP_DIR/alt_dir/test/t1.ibd
+--copy_file $MYSQL_DATA_DIR/test/t1.ibt $MYSQL_TMP_DIR/alt_dir/test/t1.ibt
+--copy_file $MYSQL_DATA_DIR/test/t1.cfg $MYSQL_TMP_DIR/alt_dir/test/t1.cfg
+--remove_file $MYSQL_DATA_DIR/test/t1.ibd
+--remove_file $MYSQL_DATA_DIR/test/t1.ibt
+--remove_file $MYSQL_DATA_DIR/test/t1.cfg
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
+ALTER TABLE t1 IMPORT TABLESPACE;
+INSERT INTO t1 VALUES (2, "Insert this record after IMPORT");
+SELECT * FROM t1;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t1;
---echo #check the table with DML operation
-DELETE FROM t1;
+--echo #
+--echo # Show that the system tables have this table in them correctly.
+--echo #
+SELECT name,n_cols,file_format,row_format
+ FROM information_schema.innodb_sys_tables WHERE name LIKE 'test%';
+SELECT name,file_format,row_format
+ FROM information_schema.innodb_sys_tablespaces;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SELECT path FROM information_schema.innodb_sys_datafiles;
+
--echo #
--echo # Cleanup
--echo #
DROP TABLE t1;
-
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.cfg.bak2
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t1.ibd.bak2
+--echo ### files in MYSQL_DATA_DIR/test
+--list_files $MYSQL_DATA_DIR/test
+--echo ### files in MYSQL_TMP_DIR/alt_dir/test
+--list_files $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir
-- disable_query_log
-eval set global innodb_file_format=$innodb_file_format_orig;
eval set global innodb_file_per_table=$innodb_file_per_table_orig;
-- enable_query_log
=== added file 'mysql-test/suite/innodb/t/portability_wl5980_linux.zip'
Binary files a/mysql-test/suite/innodb/t/portability_wl5980_linux.zip 1970-01-01 00:00:00 +0000 and b/mysql-test/suite/innodb/t/portability_wl5980_linux.zip revid:kevin.lewis@stripped differ
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (kevin.lewis:3947 to 3948) | kevin.lewis | 6 Jun |