| 1 |
--echo # |
| 2 |
--echo # Show the limitations of using a hidden directory on Windows |
| 3 |
--echo # |
| 4 |
|
| 5 |
--source include/windows.inc |
| 6 |
|
| 7 |
LET $MYSQLD_DATADIR = `select @@datadir`; |
| 8 |
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; |
| 9 |
SET default_storage_engine=InnoDB; |
| 10 |
|
| 11 |
CREATE TABLE t1 (a INT); |
| 12 |
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd'; |
| 13 |
|
| 14 |
--echo # Shutdown and make the another directory that is HIDDEN. |
| 15 |
--source include/shutdown_mysqld.inc |
| 16 |
--mkdir $MYSQL_TMP_DIR/other_dir |
| 17 |
--mkdir $MYSQL_TMP_DIR/other_dir/test |
| 18 |
--exec attrib +H $MYSQL_TMP_DIR/other_dir |
| 19 |
|
| 20 |
--echo # Copy ibdata1, test/t1.ibd and ts1.ibd to the hidden directory. |
| 21 |
--copy_file $MYSQLD_DATADIR/ibdata1 $MYSQL_TMP_DIR/other_dir/ibdata1 |
| 22 |
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQL_TMP_DIR/other_dir/test/t1.ibd |
| 23 |
--copy_file $MYSQLD_DATADIR/ts1.ibd $MYSQL_TMP_DIR/other_dir/ts1.ibd |
| 24 |
|
| 25 |
--echo # Restart with --innodb-directories=MYSQL_TMP_DIR |
| 26 |
--echo # The tablespaces in the hidden directory will not be scanned. |
| 27 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 28 |
LET $restart_parameters = restart:--innodb-directories=$MYSQL_TMP_DIR; |
| 29 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 30 |
--source include/start_mysqld.inc |
| 31 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 32 |
SHOW VARIABLES LIKE 'innodb_directories'; |
| 33 |
|
| 34 |
--echo # Show that tablespaces can be built in a HIDDEN directory. |
| 35 |
--echo # NOTE: This means that a tablespace can be created in a location that cannot be recovered. !!! |
| 36 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 37 |
eval CREATE TABLE t2 (a INT) DATA DIRECTORY='$MYSQL_TMP_DIR/other_dir'; |
| 38 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 39 |
eval CREATE TABLESPACE ts2 ADD DATAFILE '$MYSQL_TMP_DIR/other_dir/ts2.ibd'; |
| 40 |
|
| 41 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 42 |
|
| 43 |
--echo # Shutdown again. |
| 44 |
--source include/shutdown_mysqld.inc |
| 45 |
|
| 46 |
--echo # Take off the HIDDEN attribute and add SYSTEM attribute |
| 47 |
--exec attrib -H +S $MYSQL_TMP_DIR/other_dir |
| 48 |
|
| 49 |
--echo # Make a copy of the new tablespaces in the datadir |
| 50 |
--copy_file $MYSQL_TMP_DIR/other_dir/test/t2.ibd $MYSQLD_DATADIR/test/t2.ibd |
| 51 |
--copy_file $MYSQL_TMP_DIR/other_dir/ts2.ibd $MYSQLD_DATADIR/ts2.ibd |
| 52 |
|
| 53 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 54 |
--source include/start_mysqld.inc |
| 55 |
|
| 56 |
--echo # The tablespaces in the hidden directory will not be scanned and the |
| 57 |
--echo # tablespaces originally created in the hidden directory will be marked |
| 58 |
--echo # as MOVED to the datadir. |
| 59 |
|
| 60 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 61 |
|
| 62 |
--echo # Use both HIDDEN and SYSTEM attributes |
| 63 |
--exec attrib +H +S $MYSQL_TMP_DIR/other_dir |
| 64 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 65 |
--source include/restart_mysqld.inc |
| 66 |
|
| 67 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 68 |
|
| 69 |
--echo # |
| 70 |
--echo # Validate the message that should have been put into the error log. |
| 71 |
--echo # |
| 72 |
let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 73 |
let SEARCH_PATTERN=Directory '.*' will not be scanned because it is a hidden directory; |
| 74 |
--source include/search_pattern.inc |
| 75 |
|
| 76 |
--echo # |
| 77 |
--echo # Cleanup |
| 78 |
--echo # |
| 79 |
DROP TABLE t1; |
| 80 |
DROP TABLE t2; |
| 81 |
DROP TABLESPACE ts1; |
| 82 |
DROP TABLESPACE ts2; |
| 83 |
|
| 84 |
# Remove --innodb-directories= |
| 85 |
--let $restart_parameters = restart: |
| 86 |
--source include/restart_mysqld_no_echo.inc |
| 87 |
|
| 88 |
--exec attrib -S -H $MYSQL_TMP_DIR/other_dir |
| 89 |
--remove_file $MYSQL_TMP_DIR/other_dir/ibdata1 |
| 90 |
--remove_file $MYSQL_TMP_DIR/other_dir/test/t1.ibd |
| 91 |
--remove_file $MYSQL_TMP_DIR/other_dir/test/t2.ibd |
| 92 |
--remove_file $MYSQL_TMP_DIR/other_dir/ts1.ibd |
| 93 |
--remove_file $MYSQL_TMP_DIR/other_dir/ts2.ibd |
| 94 |
--rmdir $MYSQL_TMP_DIR/other_dir/test |
| 95 |
--rmdir $MYSQL_TMP_DIR/other_dir |
| 96 |
|