File: schema_myisam.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 (146 lines) | stat: -rw-r--r-- 3,880 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#
# WL#6378: New data dictionary.
#
# Replace usage of 'check_db_dir_existence()' by
# 'dd::schema_exists()'. Error handling will be
# slightly different in some situations. Below,
# six test cases check the behavior.

--source include/force_myisam_default.inc
--source include/have_myisam.inc

--disable_query_log
CALL mtr.add_suppression("Failed to find tablespace");
CALL mtr.add_suppression("Ignoring tablespace");
CALL mtr.add_suppression("Cannot rename");
CALL mtr.add_suppression("Cannot calculate");
CALL mtr.add_suppression("Cannot open datafile");
CALL mtr.add_suppression("The error means the system cannot find");
CALL mtr.add_suppression("File ./s/t_innodb.ibd");
CALL mtr.add_suppression("Operating system error number");
--enable_query_log

# 1. Create schema, remove directory, then try CREATE TABLE.

# Schema directory path.
--let $MYSQL_DATA_DIR= `select @@datadir`
--let $SCHEMA_DIR= $MYSQL_DATA_DIR/s

# Create and remove schema directory.
CREATE SCHEMA s;
--rmdir $SCHEMA_DIR

# CREATE TABLE for MyISAM fails.
--replace_result $MYSQL_DATA_DIR MYSQL_DATA_DIR/
--error 1,1
CREATE TABLE s.t (pk INTEGER PRIMARY KEY);

# Re-create the directory, then DROP will work.
--mkdir $SCHEMA_DIR
DROP SCHEMA s;


# 2. Create schema, create tables, remove directory, then try ALTER TABLE.

# Schema directory path.
--let $MYSQL_DATA_DIR= `select @@datadir`
--let $SCHEMA_DIR= $MYSQL_DATA_DIR/s

# CREATE SCHEMA.
CREATE SCHEMA s;

# CREATE TABLE for MyISAM.
CREATE TABLE s.t_myisam (pk INTEGER PRIMARY KEY);

# Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc

# Remove schema directory and files.
--remove_files_wildcard $SCHEMA_DIR *
--rmdir $SCHEMA_DIR

# Restart the server.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc

# ALTER TABLE for MyISAM fails.
--error ER_FILE_NOT_FOUND
ALTER TABLE s.t_myisam ADD COLUMN c INTEGER;

# Re-create the directory, then DROP will work.
--mkdir $SCHEMA_DIR
DROP SCHEMA s;

# 3. Create schema, create tables, remove directory, then try SHOW CREATE TABLE.

# Schema directory path.
--let $MYSQL_DATA_DIR= `select @@datadir`
--let $SCHEMA_DIR= $MYSQL_DATA_DIR/s

# CREATE SCHEMA.
CREATE SCHEMA s;

# CREATE TABLE for MyISAM.
CREATE TABLE s.t_myisam (pk INTEGER PRIMARY KEY);

# Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc

# Remove schema directory and files.
--remove_files_wildcard $SCHEMA_DIR *
--rmdir $SCHEMA_DIR

# Restart the server.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc

# SHOW CREATE TABLE for MyISAM fails.
--error ER_FILE_NOT_FOUND
SHOW CREATE TABLE s.t_myisam;

# Re-create the directory, then DROP will work.
--mkdir $SCHEMA_DIR
DROP SCHEMA s;

# 4. Create schema, create tables, remove directory, then try DROP TABLE.

# Schema directory path.
--let $MYSQL_DATA_DIR= `select @@datadir`
--let $SCHEMA_DIR= $MYSQL_DATA_DIR/s

# CREATE SCHEMA.
CREATE SCHEMA s;

# CREATE TABLE for MyISAM.
CREATE TABLE s.t_myisam (pk INTEGER PRIMARY KEY);

# Shut server down.
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc

# Remove schema directory and files.
--remove_files_wildcard $SCHEMA_DIR *
--rmdir $SCHEMA_DIR

# Restart the server.
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc

# DROP TABLE for MyISAM fails.
--error ER_ENGINE_CANT_DROP_MISSING_TABLE
DROP TABLE s.t_myisam;

# Re-create the directory, then DROP will work.
--mkdir $SCHEMA_DIR
DROP SCHEMA s;

# End of tests for WL#6378: New data dictionary.