Debian Codegraph @

mysql-test/suite/innodb/t/tablespace_portability.test

raw
1 --echo #
2 --echo # Non-Windows version of Tablespace Portability test.
3 --echo #
4 --echo # This testcase is related to WL#5980 & WL#6205.
5 --echo # It tests whether datafiles can be copied from one location
6 --echo # to another, and still be opened. In order to make this testcase run
7 --echo # on any OS, we create the tablespaces here.
8 --echo #
9
10 # On Windows, MTR converts '\' to '/' in file names.
11 # On other systems, '\' is left unchanged.
12 # So this output file is different from the Windows version.
13
14 --source include/not_windows.inc
15
16 SET DEFAULT_STORAGE_ENGINE=InnoDB;
17
18 --disable_query_log
19 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
20 LET $restart_parameters = restart:--innodb-directories=$MYSQL_TMP_DIR;
21 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
22 --source include/restart_mysqld.inc
23 --enable_query_log
24
25 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
26 SHOW VARIABLES LIKE 'innodb_directories';
27
28 --echo #
29 --echo # Try to create a tablespace in a read-only directory.
30 --echo #
31 # This section is does not work on Windows since it uses chmod to prevent
32 # a file from being created in that directory. On Windows, the user is often
33 # an Administrator who can still create files in that directory
34 --mkdir $MYSQL_TMP_DIR/read_only_dir
35 --chmod 0444 $MYSQL_TMP_DIR/read_only_dir
36 --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
37 --error ER_CREATE_FILEGROUP_FAILED
38 eval CREATE TABLESPACE s7_def ADD DATAFILE '$MYSQL_TMP_DIR/read_only_dir/s7.ibd';
39 SHOW WARNINGS;
40 --rmdir $MYSQL_TMP_DIR/read_only_dir
41
42 --disable_query_log
43 call mtr.add_suppression("\\[Warning\\] .* Converting backslash to forward slash in ADD DATAFILE");
44 call mtr.add_suppression("\\[Warning\\] .* '.*' permission error, can't delete!");
45 call mtr.add_suppression("\\[ERROR\\] .* The error means mysqld does not have the access rights to the directory.");
46 call mtr.add_suppression("\\[ERROR\\] .* Cannot create file");
47 call mtr.add_suppression("\\[ERROR\\] .* The directory for tablespace .* does not exist or is incorrect");
48 call mtr.add_suppression("\\[ERROR\\] .* Cannot create tablespace .* because the directory is not a valid location. The DATAFILE location must be in a known directory");
49 call mtr.add_suppression("\\[ERROR\\] .* Cannot create tablespace .* because the directory is not a valid location. The DATAFILE location cannot be under the datadir");
50 --enable_query_log
51
52 --source suite/innodb/include/tablespace_filenames.inc
53
54 # There is no tablespace portabilility in mysql-trunk at the moment since ISL
55 # files have been disabled and fil_ibd_open() only looks for a file in one place.
56 # --source suite/innodb/include/tablespace_portability.inc
57
58 --let $restart_parameters= restart:
59 --source include/restart_mysqld.inc
60
61
62 --echo #
63 --echo # Bug#32721533 CAN'T ALTER TABLE AFTER MOVING THE DATA FILE USING INNODB_DIRECTORIES OPTION
64 --echo #
65
66 let MYSQLD_DATADIR= `SELECT @@datadir`;
67 let INNODB_DIR=$MYSQLTEST_VARDIR/test;
68 --mkdir $INNODB_DIR
69
70 CREATE TABLE t1(a INT);
71
72 --source include/save_error_log_position.inc
73 --source include/shutdown_mysqld.inc
74
75 --copy_file $MYSQLD_DATADIR/test/t1.ibd $INNODB_DIR/t1.ibd
76 --remove_file $MYSQLD_DATADIR/test/t1.ibd
77
78 --source include/start_mysqld.inc
79
80 let $error_pattern = .*\\[Warning\\].*Tablespace .*, name 'test/t1', file '.*test.*t1.ibd' is missing;
81 --source include/assert_error_log.inc
82
83 --replace_result $INNODB_DIR INNODB_DIR
84 --let restart_parameters="restart: --innodb_directories=$INNODB_DIR"
85 --source include/restart_mysqld.inc
86
87 ALTER TABLE t1 FORCE;
88 DROP TABLE t1;
89
90 # Clean up
91 --let restart_parameters="restart: "
92 --source include/restart_mysqld.inc
93
94 --rmdir $INNODB_DIR