1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-18 17:42:20 +03:00
Files
mariadb/mysql-test/suite/innodb_zip/t/restart.test
Thirunarayanan Balathandayuthapani c0f47a4a58 MDEV-12026: Implement innodb_checksum_algorithm=full_crc32
MariaDB data-at-rest encryption (innodb_encrypt_tables)
had repurposed the same unused data field that was repurposed
in MySQL 5.7 (and MariaDB 10.2) for the Split Sequence Number (SSN)
field of SPATIAL INDEX. Because of this, MariaDB was unable to
support encryption on SPATIAL INDEX pages.

Furthermore, InnoDB page checksums skipped some bytes, and there
are multiple variations and checksum algorithms. By default,
InnoDB accepts all variations of all algorithms that ever existed.
This unnecessarily weakens the page checksums.

We hereby introduce two more innodb_checksum_algorithm variants
(full_crc32, strict_full_crc32) that are special in a way:
When either setting is active, newly created data files will
carry a flag (fil_space_t::full_crc32()) that indicates that
all pages of the file will use a full CRC-32C checksum over the
entire page contents (excluding the bytes where the checksum
is stored, at the very end of the page). Such files will always
use that checksum, no matter what the parameter
innodb_checksum_algorithm is assigned to.

For old files, the old checksum algorithms will continue to be
used. The value strict_full_crc32 will be equivalent to strict_crc32
and the value full_crc32 will be equivalent to crc32.

ROW_FORMAT=COMPRESSED tables will only use the old format.
These tables do not support new features, such as larger
innodb_page_size or instant ADD/DROP COLUMN. They may be
deprecated in the future. We do not want an unnecessary
file format change for them.

The new full_crc32() format also cleans up the MariaDB tablespace
flags. We will reserve flags to store the page_compressed
compression algorithm, and to store the compressed payload length,
so that checksum can be computed over the compressed (and
possibly encrypted) stream and can be validated without
decrypting or decompressing the page.

In the full_crc32 format, there no longer are separate before-encryption
and after-encryption checksums for pages. The single checksum is
computed on the page contents that is written to the file.

We do not make the new algorithm the default for two reasons.
First, MariaDB 10.4.2 was a beta release, and the default values
of parameters should not change after beta. Second, we did not
yet implement the full_crc32 format for page_compressed pages.
This will be fixed in MDEV-18644.

This is joint work with Marko Mäkelä.
2019-02-19 18:50:19 +02:00

571 lines
24 KiB
Plaintext

#
# 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
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.");
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir
--list_files $MYSQL_TMP_DIR/alt_dir
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/alt_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/alt_dir/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--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
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_DATA_DIR/test
--echo ---- MYSQL_TMP_DIR/new_dir/test
--replace_result #P# #p# #SP# #sp#
--list_files $MYSQL_TMP_DIR/new_dir/test
--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