File: tablespace_portability.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (94 lines) | stat: -rw-r--r-- 3,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
--echo #
--echo # Non-Windows version of Tablespace Portability test.
--echo #
--echo # This testcase is related to WL#5980 & WL#6205.
--echo # It tests whether datafiles can be copied from one location
--echo # to another, and still be opened. In order to make this testcase run
--echo # on any OS, we create the tablespaces here.
--echo #

# On Windows, MTR converts '\' to '/' in file names.
# On other systems, '\' is left unchanged.
# So this output file is different from the Windows version.

--source include/not_windows.inc

SET DEFAULT_STORAGE_ENGINE=InnoDB;

--disable_query_log
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
LET $restart_parameters = restart:--innodb-directories=$MYSQL_TMP_DIR;
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--source include/restart_mysqld.inc
--enable_query_log

--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
SHOW VARIABLES LIKE 'innodb_directories';

--echo #
--echo # Try to create a tablespace in a read-only directory.
--echo #
# This section is does not work on Windows since it uses chmod to prevent
# a file from being created in that directory.  On Windows, the user is often
# an Administrator who can still create files in that directory
--mkdir $MYSQL_TMP_DIR/read_only_dir
--chmod 0444 $MYSQL_TMP_DIR/read_only_dir
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_CREATE_FILEGROUP_FAILED
eval CREATE TABLESPACE s7_def ADD DATAFILE '$MYSQL_TMP_DIR/read_only_dir/s7.ibd';
SHOW WARNINGS;
--rmdir $MYSQL_TMP_DIR/read_only_dir

--disable_query_log
call mtr.add_suppression("\\[Warning\\] .* Converting backslash to forward slash in ADD DATAFILE");
call mtr.add_suppression("\\[Warning\\] .* '.*' permission error, can't delete!");
call mtr.add_suppression("\\[ERROR\\] .* The error means mysqld does not have the access rights to the directory.");
call mtr.add_suppression("\\[ERROR\\] .* Cannot create file");
call mtr.add_suppression("\\[ERROR\\] .* The directory for tablespace .* does not exist or is incorrect");
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");
call mtr.add_suppression("\\[ERROR\\] .* Cannot create tablespace .* because the directory is not a valid location. The DATAFILE location cannot be under the datadir");
--enable_query_log

--source suite/innodb/include/tablespace_filenames.inc

# There is no tablespace portabilility in mysql-trunk at the moment since ISL
# files have been disabled and fil_ibd_open() only looks for a file in one place.
# --source suite/innodb/include/tablespace_portability.inc

--let $restart_parameters= restart:
--source include/restart_mysqld.inc


--echo #
--echo # Bug#32721533 CAN'T ALTER TABLE AFTER MOVING THE DATA FILE USING INNODB_DIRECTORIES OPTION
--echo #

let MYSQLD_DATADIR= `SELECT @@datadir`;
let INNODB_DIR=$MYSQLTEST_VARDIR/test;
--mkdir $INNODB_DIR

CREATE TABLE t1(a INT);

--source include/save_error_log_position.inc
--source include/shutdown_mysqld.inc

--copy_file $MYSQLD_DATADIR/test/t1.ibd $INNODB_DIR/t1.ibd
--remove_file $MYSQLD_DATADIR/test/t1.ibd

--source include/start_mysqld.inc

let $error_pattern = .*\\[Warning\\].*Tablespace .*, name 'test/t1', file '.*test.*t1.ibd' is missing;
--source include/assert_error_log.inc

--replace_result $INNODB_DIR INNODB_DIR
--let restart_parameters="restart: --innodb_directories=$INNODB_DIR"
--source include/restart_mysqld.inc

ALTER TABLE t1 FORCE;
DROP TABLE t1;

# Clean up
--let restart_parameters="restart: "
--source include/restart_mysqld.inc

--rmdir $INNODB_DIR