summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb_zip/t/restart.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/innodb_zip/t/restart.test')
-rw-r--r--mysql-test/suite/innodb_zip/t/restart.test606
1 files changed, 606 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test
new file mode 100644
index 00000000..c442b919
--- /dev/null
+++ b/mysql-test/suite/innodb_zip/t/restart.test
@@ -0,0 +1,606 @@
+#
+# These test make sure that tables are visible after rebooting
+#
+--source include/innodb_page_size_small.inc
+--source include/have_partition.inc
+--source include/not_embedded.inc
+--source include/innodb_checksum_algorithm.inc
+--source include/have_symlink.inc
+
+SET default_storage_engine=InnoDB;
+LET $MYSQLD_DATADIR = `select @@datadir`;
+LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
+
+--disable_query_log
+# This error is expected in the error log for this test.
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Error number 17 means 'File exists'");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number (17|80) in a file operation.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot create file .*t55_restart.isl");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The link file: .* already exists.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot open datafile for read-only:");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number 2 in a file operation.");
+call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified.");
+--enable_query_log
+
+--echo #
+--echo # A series of tests to make sure tables are opened after restart.
+--echo # Bug#13357607 Compressed file-per-table tablespaces fail to open
+--echo #
+# This bug was introduced without a regression test failing since
+# there were no tests showing that tablespaces could be created and
+# then read after reboot.
+#
+
+--disable_query_log
+let $MYSQL_DATA_DIR= `select @@datadir`;
+let $data_directory = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
+
+let $innodb_file_per_table_orig=`select @@innodb_file_per_table`;
+--enable_query_log
+
+set global innodb_file_per_table=on;
+
+--echo #
+--echo # Create and insert records into a REDUNDANT row formatted table.
+--echo #
+CREATE TABLE t1_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=REDUNDANT ENGINE=InnoDB;
+INSERT INTO t1_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
+INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
+INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
+INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
+SHOW CREATE TABLE t1_restart;
+SELECT count(*) FROM t1_restart;
+
+--echo #
+--echo # Create and insert records into a COMPACT row formatted table.
+--echo #
+CREATE TABLE t2_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=COMPACT ENGINE=InnoDB;
+INSERT INTO t2_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
+INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
+INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
+INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
+SHOW CREATE TABLE t2_restart;
+SELECT count(*) FROM t2_restart;
+
+--echo #
+--echo # Create and insert records into a COMPRESSED row formatted table.
+--echo #
+CREATE TABLE t3_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB;
+INSERT INTO t3_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
+INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
+INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
+INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
+SHOW CREATE TABLE t3_restart;
+SELECT count(*) FROM t3_restart;
+
+--echo #
+--echo # Create and insert records into a DYNAMIC row formatted table.
+--echo #
+CREATE TABLE t4_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=DYNAMIC ENGINE=InnoDB;
+INSERT INTO t4_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+SHOW CREATE TABLE t4_restart;
+SELECT count(*) FROM t4_restart;
+
+--echo #
+--echo # Create and insert records into a table that uses a remote DATA DIRECTORY.
+--echo #
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t5_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=DYNAMIC ENGINE=InnoDB $data_directory;
+INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t5_restart;
+SELECT count(*) FROM t5_restart;
+
+--echo #
+--echo # Create and insert records into a partitioned table that uses
+--echo # a remote DATA DIRECTORY for each partition.
+--echo #
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t6_restart(
+ c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB
+ PARTITION BY HASH(c1) (
+ PARTITION p0 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
+ PARTITION p1 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
+ PARTITION p2 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir');
+INSERT INTO t6_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
+INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
+INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
+INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t6_restart;
+SELECT count(*) FROM t6_restart;
+
+--echo #
+--echo # Create and insert records into a subpartitioned table that uses
+--echo # a remote DATA DIRECTORY for each subpartition.
+--echo #
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE t7_restart(
+ c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT)
+ ROW_FORMAT=DYNAMIC ENGINE=InnoDB
+ PARTITION BY RANGE(c1) SUBPARTITION BY HASH(c1) (
+ PARTITION p0 VALUES LESS THAN (10) (
+ SUBPARTITION s0 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
+ SUBPARTITION s1 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir'),
+ PARTITION p1 VALUES LESS THAN MAXVALUE (
+ SUBPARTITION s2 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir',
+ SUBPARTITION s3 DATA DIRECTORY = '$MYSQL_TMP_DIR/alt_dir'));
+INSERT INTO t7_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
+INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
+INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
+INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t7_restart;
+SELECT count(*) FROM t7_restart;
+
+--echo #
+--echo # Show these tables in information_schema.
+--echo #
+--source suite/innodb/include/show_i_s_tables.inc
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+--echo #
+--echo # Shutdown the server and list the tablespace OS files
+--echo #
+--source include/shutdown_mysqld.inc
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir
+--list_files $MYSQL_TMP_DIR/alt_dir
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Start the server and show that tables are still visible and accessible.
+--echo #
+--source include/start_mysqld.inc
+
+SHOW VARIABLES LIKE 'innodb_file_per_table';
+SHOW CREATE TABLE t1_restart;
+SHOW CREATE TABLE t2_restart;
+SHOW CREATE TABLE t3_restart;
+SHOW CREATE TABLE t4_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t5_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t6_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t7_restart;
+
+INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart);
+INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart);
+INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart);
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart);
+INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart);
+
+SELECT count(*) FROM t1_restart;
+SELECT count(*) FROM t2_restart;
+SELECT count(*) FROM t3_restart;
+SELECT count(*) FROM t4_restart;
+SELECT count(*) FROM t5_restart;
+SELECT count(*) FROM t6_restart;
+SELECT count(*) FROM t7_restart;
+
+--echo #
+--echo # Show these tables in information_schema.
+--echo #
+--source suite/innodb/include/show_i_s_tables.inc
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+DROP TABLE t1_restart;
+DROP TABLE t2_restart;
+DROP TABLE t3_restart;
+# Tablespace for t4_restart will be moved later from default directory to a new directory
+# and an ISL file will be created not using InnoDB.
+# Table t5_restart will be expanded.
+# Tables t6_restart and t7_restart will be truncated.
+
+--echo #
+--echo # Truncate the remote tablespaces.
+--echo #
+TRUNCATE TABLE t5_restart;
+ALTER TABLE t6_restart TRUNCATE PARTITION p2;
+ALTER TABLE t7_restart TRUNCATE PARTITION p1;
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot');
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart);
+
+SELECT count(*) FROM t5_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t5_restart;
+
+SELECT count(*) FROM t6_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t6_restart;
+
+SELECT count(*) FROM t7_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t7_restart;
+
+--echo #
+--echo # Shutdown the server and make a backup of a tablespace
+--echo #
+--source include/shutdown_mysqld.inc
+
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak
+--copy_file $MYSQL_DATA_DIR/test/t5_restart.isl $MYSQL_DATA_DIR/test/t5_restart.isl.bak
+--copy_file $MYSQL_DATA_DIR/test/t5_restart.frm $MYSQL_DATA_DIR/test/t5_restart.frm.bak
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Start the server and show the tablespaces.
+--echo #
+--source include/start_mysqld.inc
+
+SHOW VARIABLES LIKE 'innodb_file_per_table';
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+SELECT count(*) FROM t5_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t5_restart;
+
+SELECT count(*) FROM t6_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t6_restart;
+
+SELECT count(*) FROM t7_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t7_restart;
+
+--echo #
+--echo # Try to rename a tablespace to a file that already exists
+--echo #
+
+--copy_file $MYSQL_DATA_DIR/test/t5_restart.frm.bak $MYSQL_DATA_DIR/test/t55_restart.frm
+--error ER_TABLE_EXISTS_ERROR
+RENAME TABLE t5_restart TO t55_restart;
+--remove_file $MYSQL_DATA_DIR/test/t55_restart.frm
+--remove_file $MYSQL_DATA_DIR/test/t5_restart.frm.bak
+
+--copy_file $MYSQL_DATA_DIR/test/t5_restart.isl.bak $MYSQL_DATA_DIR/test/t55_restart.isl
+--error ER_ERROR_ON_RENAME
+RENAME TABLE t5_restart TO t55_restart;
+--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
+--remove_file $MYSQL_DATA_DIR/test/t5_restart.isl.bak
+
+#--copy_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
+# This RENAME TABLE works of Linux but gets ER_ERROR_ON_RENAME on Windows
+#--error ER_ERROR_ON_RENAME
+#RENAME TABLE t5_restart TO t55_restart;
+#--remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Rename file table and tablespace
+--echo #
+
+RENAME TABLE t5_restart TO t55_restart;
+RENAME TABLE t6_restart TO t66_restart;
+RENAME TABLE t7_restart TO t77_restart;
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
+SELECT count(*) FROM t55_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t55_restart;
+
+INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
+SELECT count(*) FROM t66_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t66_restart;
+
+INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
+SELECT count(*) FROM t77_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t77_restart;
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Restart the server
+--echo #
+--source include/restart_mysqld.inc
+SHOW VARIABLES LIKE 'innodb_file_per_table';
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
+SELECT count(*) FROM t55_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t55_restart;
+
+INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
+SELECT count(*) FROM t66_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t66_restart;
+
+INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
+SELECT count(*) FROM t77_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t77_restart;
+
+--echo #
+--echo # Shutdown the server
+--echo #
+--source include/shutdown_mysqld.inc
+
+--echo #
+--echo # Move the remote tablespaces to a new location and change the ISL files
+--echo #
+--mkdir $MYSQL_TMP_DIR/new_dir
+--mkdir $MYSQL_TMP_DIR/new_dir/test
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/new_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo # Moving tablespace 't4_restart' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir
+--copy_file $MYSQL_DATA_DIR/test/t4_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
+--remove_file $MYSQL_DATA_DIR/test/t4_restart.ibd
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd > $MYSQL_DATA_DIR/test/t4_restart.isl
+
+--echo # Moving tablespace 't55_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t55_restart.ibd
+--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd > $MYSQL_DATA_DIR/test/t55_restart.isl
+
+--echo # Moving tablespace 't66_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p1.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p2.ibd $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p0.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p1.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t66_restart#P#p2.ibd
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd > $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
+
+--echo # Moving tablespace 't77_restart' from MYSQL_TMP_DIR/alt_dir to MYSQL_TMP_DIR/new_dir
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd
+--copy_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s0.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p0#SP#s1.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s2.ibd
+--remove_file $MYSQL_TMP_DIR/alt_dir/test/t77_restart#P#p1#SP#s3.ibd
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
+--exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/alt_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/new_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Start the server and check tablespaces.
+--echo #
+--source include/start_mysqld.inc
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+SELECT count(*) FROM t4_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t4_restart;
+
+INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
+SELECT count(*) FROM t55_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t55_restart;
+
+INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
+SELECT count(*) FROM t66_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t66_restart;
+
+INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
+SELECT count(*) FROM t77_restart;
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+SHOW CREATE TABLE t77_restart;
+
+
+--echo #
+--echo # Shutdown the server
+--echo #
+--source include/shutdown_mysqld.inc
+
+--echo #
+--echo # Move the remote tablespaces back to the default datadir and delete the ISL file.
+--echo #
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/new_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo # Moving 't4_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd $MYSQL_DATA_DIR/test/t4_restart.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd
+--remove_file $MYSQL_DATA_DIR/test/t4_restart.isl
+
+--echo # Moving 't55_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd $MYSQL_DATA_DIR/test/t55_restart.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t55_restart.ibd
+--remove_file $MYSQL_DATA_DIR/test/t55_restart.isl
+
+--echo # Moving 't66_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p0.ibd
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p1.ibd
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd $MYSQL_DATA_DIR/test/t66_restart#P#p2.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p0.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p1.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t66_restart#P#p2.ibd
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p0.isl
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p1.isl
+--remove_file $MYSQL_DATA_DIR/test/t66_restart#P#p2.isl
+
+--echo # Moving 't77_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.ibd
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.ibd
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.ibd
+--copy_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s0.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p0#SP#s1.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s2.ibd
+--remove_file $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s0.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p0#SP#s1.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s2.isl
+--remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl
+
+--echo ---- MYSQL_DATA_DIR/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+--echo ---- MYSQL_TMP_DIR/new_dir/test
+--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test
+--replace_result #P# #p# #SP# #sp#
+--cat_file $MYSQLD_DATADIR.files.txt
+--remove_file $MYSQLD_DATADIR.files.txt
+
+--echo #
+--echo # Start the server and check tablespaces.
+--echo #
+-- source include/start_mysqld.inc
+
+--source suite/innodb/include/show_i_s_tablespaces.inc
+
+INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart);
+SELECT count(*) FROM t4_restart;
+SHOW CREATE TABLE t4_restart;
+
+INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart);
+SELECT count(*) FROM t55_restart;
+SHOW CREATE TABLE t55_restart;
+
+INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart);
+SELECT count(*) FROM t66_restart;
+SHOW CREATE TABLE t66_restart;
+
+INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart);
+SELECT count(*) FROM t77_restart;
+SHOW CREATE TABLE t77_restart;
+
+
+--echo #
+--echo # Cleanup
+--echo #
+
+DROP TABLE t4_restart;
+DROP TABLE t55_restart;
+DROP TABLE t66_restart;
+DROP TABLE t77_restart;
+
+--rmdir $MYSQL_TMP_DIR/alt_dir/test
+--rmdir $MYSQL_TMP_DIR/alt_dir
+--rmdir $MYSQL_TMP_DIR/new_dir/test
+--rmdir $MYSQL_TMP_DIR/new_dir
+
+-- disable_query_log
+eval set global innodb_file_per_table=$innodb_file_per_table_orig;
+-- enable_query_log
+