mariadb/mysql-test/suite/archive/archive_symlink.test
Michael Widenius 39e6083e35 MDEV-5818: MySQL WL#6145: Separate the dependence of DATA DIRECTORY from symbolic links
Copied relevant test cases and code from the MySQL 5.6 tree
Testing of my_use_symdir moved to engines.


mysql-test/r/partition_windows.result:
  Updated result file
mysql-test/suite/archive/archive_no_symlink-master.opt:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_no_symlink.result:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_no_symlink.test:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_symlink.result:
  Testing of symlinks with archive
mysql-test/suite/archive/archive_symlink.test:
  Testing of symlinks with archive
sql/log_event.cc:
  Updated comment
sql/partition_info.cc:
  Don't test my_use_symdir here
sql/sql_parse.cc:
  Updated comment
sql/sql_table.cc:
  Don't test my_use_symdir here
sql/table.cc:
  Added more DBUG_PRINT
storage/archive/ha_archive.cc:
  Give warnings for index_file_name and if we can't use data directory
storage/myisam/ha_myisam.cc:
  Give warnings if we can't use data directory or index directory
2014-03-23 17:00:29 +02:00

72 lines
2.5 KiB
Text

# Test archive engine when symbolic links are available.
--source include/not_windows.inc
--source include/have_archive.inc
# DATA DIRECTORY/INDEX DIRECTORY require symbolic link support
--source include/have_symlink.inc
let $MYSQLD_DATADIR= `select @@datadir`;
let $data_directory = DATA DIRECTORY = '$MYSQL_TMP_DIR/archive';
let $index_directory = INDEX DIRECTORY = '$MYSQL_TMP_DIR/archive';
--echo #
--echo # Archive can only use an existing directory for DATA DIRECTORY.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_CANT_CREATE_TABLE
eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
ENGINE archive $data_directory $index_directory;
--echo #
--echo # mkdir MYSQL_TMP_DIR/archive and try again...
--echo # Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY.
--echo #
--mkdir $MYSQL_TMP_DIR/archive
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
ENGINE archive $data_directory $index_directory;
INSERT INTO t1 VALUES (NULL, "blue");
INSERT INTO t1 VALUES (NULL, "red");
INSERT INTO t1 VALUES (NULL, "yellow");
--echo # Checking if archive file exists where we specified in DATA DIRECTORY
--file_exists $MYSQL_TMP_DIR/archive/t1.ARZ
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY
--echo #
SET @org_mode=@@sql_mode;
SET @@sql_mode='NO_DIR_IN_CREATE';
SELECT @@sql_mode;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
ENGINE archive $data_directory;
INSERT INTO t1 VALUES (NULL, "blue");
INSERT INTO t1 VALUES (NULL, "red");
INSERT INTO t1 VALUES (NULL, "yellow");
--echo # Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
--file_exists $MYSQLD_DATADIR/test/t1.ARZ
DROP TABLE t1;
set @@sql_mode=@org_mode;
--echo #
--echo # MySQL engine does not allow DATA DIRECTORY to be
--echo # within --datadir for any engine, including Archive
--echo #
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
ENGINE archive DATA DIRECTORY '$MYSQLD_DATADIR/test';
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--error ER_WRONG_ARGUMENTS
eval CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1))
ENGINE archive INDEX DIRECTORY '$MYSQLD_DATADIR/test';
--echo #
--echo # Cleanup
--echo #
--rmdir $MYSQL_TMP_DIR/archive