#
# Show the limitations of using a 'dotfile' hidden directory
#
SET default_storage_engine=InnoDB;
CREATE TABLE t1 (a INT);
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
# Shutdown and make the another directory that is HIDDEN.
# Copy ibdata1, test/t1.ibd and ts1.ibd to the hidden directory.
# Restart with the --innodb-directories=MYSQL_TMP_DIR
#   The tablespaces in the hidden directory will not be scanned.
# restart:--innodb-directories=MYSQL_TMP_DIR
SHOW VARIABLES LIKE 'innodb_directories';
Variable_name	Value
innodb_directories	MYSQL_TMP_DIR
# Show that tablespaces can be built in a HIDDEN directory.
# NOTE: This means that a tablespace can be created in a location that cannot be recovered. !!!
CREATE TABLE t2 (a INT) DATA DIRECTORY='MYSQL_TMP_DIR/.other_dir';
CREATE TABLESPACE ts2 ADD DATAFILE 'MYSQL_TMP_DIR/.other_dir/ts2.ibd';
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name	Space_Type	Page_Size	Zip_Size	BlockSize!=0	FileSize!=0	Formats_Permitted	Path
mtr/global_suppressions	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_suppressions	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t1	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/test/t1.ibd
test/t2	Single	DEFAULT	0	1	1	Dynamic	MYSQL_TMP_DIR/.other_dir/test/t2.ibd
ts1	General	DEFAULT	0	1	1	Any	ts1.ibd
ts2	General	DEFAULT	0	1	1	Any	MYSQL_TMP_DIR/.other_dir/ts2.ibd
=== information_schema.files ===
Space_Name	File_Type	Engine	Status	Tablespace_Name	Path
mtr/global_suppressions	TABLESPACE	InnoDB	NORMAL	mtr/global_suppressions	MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_suppressions	TABLESPACE	InnoDB	NORMAL	mtr/test_suppressions	MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t1	TABLESPACE	InnoDB	NORMAL	test/t1	MYSQLD_DATADIR/test/t1.ibd
test/t2	TABLESPACE	InnoDB	NORMAL	test/t2	MYSQL_TMP_DIR/.other_dir/test/t2.ibd
ts1	TABLESPACE	InnoDB	NORMAL	ts1	MYSQLD_DATADIR/ts1.ibd
ts2	TABLESPACE	InnoDB	NORMAL	ts2	MYSQL_TMP_DIR/.other_dir/ts2.ibd
# Shutdown again.
# Make a copy of the new tablespaces in the datadir
# Restart again.
#   The tablespaces in the hidden directory will not be scanned and the
#   tablespaces originally created in the hidden directory will be marked
#   as MOVED to the datadir.
# restart:--innodb-directories=MYSQL_TMP_DIR
=== information_schema.innodb_tablespaces and innodb_datafiles ===
Space_Name	Space_Type	Page_Size	Zip_Size	BlockSize!=0	FileSize!=0	Formats_Permitted	Path
mtr/global_suppressions	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_suppressions	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t1	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/test/t1.ibd
test/t2	Single	DEFAULT	0	1	1	Dynamic	MYSQLD_DATADIR/test/t2.ibd
ts1	General	DEFAULT	0	1	1	Any	ts1.ibd
ts2	General	DEFAULT	0	1	1	Any	MYSQLD_DATADIR/ts2.ibd
=== information_schema.files ===
Space_Name	File_Type	Engine	Status	Tablespace_Name	Path
mtr/global_suppressions	TABLESPACE	InnoDB	NORMAL	mtr/global_suppressions	MYSQLD_DATADIR/mtr/global_suppressions.ibd
mtr/test_suppressions	TABLESPACE	InnoDB	NORMAL	mtr/test_suppressions	MYSQLD_DATADIR/mtr/test_suppressions.ibd
test/t1	TABLESPACE	InnoDB	NORMAL	test/t1	MYSQLD_DATADIR/test/t1.ibd
test/t2	TABLESPACE	InnoDB	NORMAL	test/t2	MYSQLD_DATADIR/test/t2.ibd
ts1	TABLESPACE	InnoDB	NORMAL	ts1	MYSQLD_DATADIR/ts1.ibd
ts2	TABLESPACE	InnoDB	NORMAL	ts2	MYSQLD_DATADIR/ts2.ibd
#
# Validate the message that should have been put into the error log.
#
Pattern "Directory '.*' will not be scanned because it is a hidden directory" found
#
# Cleanup
#
DROP TABLE t1;
DROP TABLE t2;
DROP TABLESPACE ts1;
DROP TABLESPACE ts2;
# restart:
