| 1 |
# |
| 2 |
# These test make sure that tables are visible after rebooting |
| 3 |
# |
| 4 |
|
| 5 |
--source include/have_innodb_max_16k.inc |
| 6 |
|
| 7 |
SET default_storage_engine=InnoDB; |
| 8 |
LET $MYSQLD_DATADIR = `select @@datadir`; |
| 9 |
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; |
| 10 |
|
| 11 |
--disable_query_log |
| 12 |
# This error is expected in the error log for this test. |
| 13 |
call mtr.add_suppression("\\[ERROR\\] Error number 17 means 'File exists'"); |
| 14 |
call mtr.add_suppression("\\[ERROR\\] Operating system error number (17|80) in a file operation."); |
| 15 |
call mtr.add_suppression("\\[ERROR\\] The link file: .* already exists."); |
| 16 |
call mtr.add_suppression("\\[ERROR\\] Cannot open datafile for read-only:"); |
| 17 |
call mtr.add_suppression("\\[ERROR\\] Operating system error number 2 in a file operation."); |
| 18 |
call mtr.add_suppression("\\[ERROR\\] The error means the system cannot find the path specified."); |
| 19 |
call mtr.add_suppression("\\[ERROR\\] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them."); |
| 20 |
call mtr.add_suppression("\\[Warning\\] Tablespace .*, name 'innodb_file_per_table.*', file '.*alt_dir/move_test/.*\.ibd' has been moved to '.*alt_dir_moved/move_test/.*\.ibd'"); |
| 21 |
--enable_query_log |
| 22 |
|
| 23 |
--echo # |
| 24 |
--echo # A series of tests to make sure tables are opened after restart. |
| 25 |
--echo # Bug#13357607 Compressed file-per-table tablespaces fail to open |
| 26 |
--echo # |
| 27 |
# This bug was introduced without a regression test failing since |
| 28 |
# there were no tests showing that tablespaces could be created and |
| 29 |
# then read after reboot. |
| 30 |
# |
| 31 |
|
| 32 |
--disable_query_log |
| 33 |
|
| 34 |
LET $SCHEMA_NAME = move_test; |
| 35 |
LET $MYSQL_DATA_DIR = `select @@datadir`; |
| 36 |
LET $ALT_DIR = $MYSQL_TMP_DIR/alt_dir; |
| 37 |
LET $ALT_DATA_DIR = DATA DIRECTORY='$ALT_DIR'; |
| 38 |
LET $ALT_DIR_MOVED = $MYSQL_TMP_DIR/alt_dir_moved; |
| 39 |
|
| 40 |
LET $innodb_file_per_table_orig=`select @@innodb_file_per_table`; |
| 41 |
|
| 42 |
--echo # |
| 43 |
--echo # Restart with innodb-directories set to MYSQL_TMP_DIR/alt_dir. |
| 44 |
--echo # |
| 45 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 46 |
LET $restart_parameters = restart:--innodb-directories=$ALT_DIR; |
| 47 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 48 |
--source include/restart_mysqld.inc |
| 49 |
|
| 50 |
--enable_query_log |
| 51 |
|
| 52 |
eval CREATE DATABASE $SCHEMA_NAME; |
| 53 |
eval USE $SCHEMA_NAME; |
| 54 |
|
| 55 |
set global innodb_file_per_table=on; |
| 56 |
|
| 57 |
--echo # |
| 58 |
--echo # Create and insert records into a REDUNDANT row formatted table. |
| 59 |
--echo # |
| 60 |
CREATE TABLE t1_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 61 |
ROW_FORMAT=REDUNDANT ENGINE=InnoDB; |
| 62 |
INSERT INTO t1_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 63 |
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); |
| 64 |
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); |
| 65 |
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); |
| 66 |
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); |
| 67 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 68 |
SHOW CREATE TABLE t1_restart; |
| 69 |
SELECT count(*) FROM t1_restart; |
| 70 |
|
| 71 |
--echo # |
| 72 |
--echo # Create and insert records into a COMPACT row formatted table. |
| 73 |
--echo # |
| 74 |
CREATE TABLE t2_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 75 |
ROW_FORMAT=COMPACT ENGINE=InnoDB; |
| 76 |
INSERT INTO t2_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 77 |
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 78 |
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 79 |
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 80 |
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 81 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 82 |
SHOW CREATE TABLE t2_restart; |
| 83 |
SELECT count(*) FROM t2_restart; |
| 84 |
|
| 85 |
--echo # |
| 86 |
--echo # Create and insert records into a COMPRESSED row formatted table. |
| 87 |
--echo # |
| 88 |
CREATE TABLE t3_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 89 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB; |
| 90 |
INSERT INTO t3_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 91 |
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); |
| 92 |
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); |
| 93 |
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); |
| 94 |
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); |
| 95 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 96 |
SHOW CREATE TABLE t3_restart; |
| 97 |
SELECT count(*) FROM t3_restart; |
| 98 |
|
| 99 |
--echo # |
| 100 |
--echo # Create and insert records into a DYNAMIC row formatted table. |
| 101 |
--echo # |
| 102 |
CREATE TABLE t4_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 103 |
ROW_FORMAT=DYNAMIC ENGINE=InnoDB; |
| 104 |
INSERT INTO t4_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 105 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 106 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 107 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 108 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 109 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 110 |
SHOW CREATE TABLE t4_restart; |
| 111 |
SELECT count(*) FROM t4_restart; |
| 112 |
|
| 113 |
--echo # |
| 114 |
--echo # Create and insert records into a table that uses a remote DATA DIRECTORY. |
| 115 |
--echo # |
| 116 |
--echo # |
| 117 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 118 |
eval CREATE TABLE t5_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 119 |
ROW_FORMAT=DYNAMIC ENGINE=InnoDB $ALT_DATA_DIR; |
| 120 |
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 121 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 122 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 123 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 124 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 125 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 126 |
SHOW CREATE TABLE t5_restart; |
| 127 |
SELECT count(*) FROM t5_restart; |
| 128 |
|
| 129 |
--echo # |
| 130 |
--echo # Create and insert records into a partitioned table that uses |
| 131 |
--echo # a remote DATA DIRECTORY for each partition. |
| 132 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 133 |
eval CREATE TABLE t6_restart( |
| 134 |
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 135 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 ENGINE=InnoDB |
| 136 |
PARTITION BY HASH(c1) ( |
| 137 |
PARTITION p0 $ALT_DATA_DIR, |
| 138 |
PARTITION p1 $ALT_DATA_DIR, |
| 139 |
PARTITION p2 $ALT_DATA_DIR); |
| 140 |
INSERT INTO t6_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 141 |
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); |
| 142 |
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); |
| 143 |
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); |
| 144 |
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); |
| 145 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 146 |
SHOW CREATE TABLE t6_restart; |
| 147 |
SELECT count(*) FROM t6_restart; |
| 148 |
|
| 149 |
--echo # |
| 150 |
--echo # Create and insert records into a subpartitioned table that uses |
| 151 |
--echo # a remote DATA DIRECTORY for each subpartition. |
| 152 |
--echo # |
| 153 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 154 |
eval CREATE TABLE t7_restart( |
| 155 |
c1 INT AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 156 |
ROW_FORMAT=DYNAMIC ENGINE=InnoDB |
| 157 |
PARTITION BY RANGE(c1) SUBPARTITION BY HASH(c1) ( |
| 158 |
PARTITION p0 VALUES LESS THAN (10) ( |
| 159 |
SUBPARTITION s0 $ALT_DATA_DIR, |
| 160 |
SUBPARTITION s1 $ALT_DATA_DIR), |
| 161 |
PARTITION p1 VALUES LESS THAN MAXVALUE ( |
| 162 |
SUBPARTITION s2 $ALT_DATA_DIR, |
| 163 |
SUBPARTITION s3 $ALT_DATA_DIR)); |
| 164 |
INSERT INTO t7_restart VALUES (0, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 165 |
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); |
| 166 |
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); |
| 167 |
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); |
| 168 |
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); |
| 169 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 170 |
SHOW CREATE TABLE t7_restart; |
| 171 |
SELECT count(*) FROM t7_restart; |
| 172 |
|
| 173 |
--echo # |
| 174 |
--echo # Create and insert records into a table that uses a general tablespace. |
| 175 |
--echo # |
| 176 |
CREATE TABLESPACE s1_restart ADD DATAFILE 's1_restart.ibd'; |
| 177 |
CREATE TABLE t8_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 178 |
ROW_FORMAT=COMPACT ENGINE=InnoDB TABLESPACE=s1_restart; |
| 179 |
INSERT INTO t8_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 180 |
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 181 |
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 182 |
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 183 |
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 184 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 185 |
SHOW CREATE TABLE t8_restart; |
| 186 |
SELECT count(*) FROM t8_restart; |
| 187 |
CREATE TABLE t9_restart(c1 DOUBLE AUTO_INCREMENT KEY, c2 CHAR(10), c3 VARCHAR(100), c4 DATE, c5 TEXT) |
| 188 |
ROW_FORMAT=DYNAMIC ENGINE=InnoDB TABLESPACE=s1_restart; |
| 189 |
INSERT INTO t9_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 190 |
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 191 |
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 192 |
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 193 |
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 194 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 195 |
SHOW CREATE TABLE t9_restart; |
| 196 |
SELECT count(*) FROM t9_restart; |
| 197 |
|
| 198 |
--echo # |
| 199 |
--echo # Show these tables in information_schema. |
| 200 |
--echo # |
| 201 |
--source suite/innodb/include/show_i_s_tables.inc |
| 202 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 203 |
|
| 204 |
--echo # |
| 205 |
--echo # Shutdown the server and list the tablespace OS files |
| 206 |
--echo # |
| 207 |
--source include/shutdown_mysqld.inc |
| 208 |
|
| 209 |
--echo ---- MYSQL_DATA_DIR/$SCHEMA_NAME |
| 210 |
--replace_result #P# #p# #SP# #sp# |
| 211 |
--list_files $MYSQL_DATA_DIR$SCHEMA_NAME |
| 212 |
--echo ---- ALT_DIR |
| 213 |
--list_files $ALT_DIR |
| 214 |
--echo ---- ALT_DIR/$SCHEMA_NAME |
| 215 |
--replace_result #P# #p# #SP# #sp# |
| 216 |
--list_files $ALT_DIR/$SCHEMA_NAME |
| 217 |
|
| 218 |
--echo # |
| 219 |
--echo # Start the server and show that tables are still visible and accessible. |
| 220 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 221 |
--source include/start_mysqld.inc |
| 222 |
|
| 223 |
SHOW VARIABLES LIKE 'innodb_file_per_table'; |
| 224 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 225 |
SHOW CREATE TABLE t1_restart; |
| 226 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 227 |
SHOW CREATE TABLE t2_restart; |
| 228 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 229 |
SHOW CREATE TABLE t3_restart; |
| 230 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 231 |
SHOW CREATE TABLE t4_restart; |
| 232 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 233 |
SHOW CREATE TABLE t5_restart; |
| 234 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 235 |
SHOW CREATE TABLE t6_restart; |
| 236 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 237 |
SHOW CREATE TABLE t7_restart; |
| 238 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 239 |
SHOW CREATE TABLE t8_restart; |
| 240 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 241 |
SHOW CREATE TABLE t9_restart; |
| 242 |
|
| 243 |
INSERT INTO t1_restart (SELECT 0, c2, c3, c4, c5 FROM t1_restart); |
| 244 |
INSERT INTO t2_restart (SELECT 0, c2, c3, c4, c5 FROM t2_restart); |
| 245 |
INSERT INTO t3_restart (SELECT 0, c2, c3, c4, c5 FROM t3_restart); |
| 246 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 247 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 248 |
INSERT INTO t6_restart (SELECT 0, c2, c3, c4, c5 FROM t6_restart); |
| 249 |
INSERT INTO t7_restart (SELECT 0, c2, c3, c4, c5 FROM t7_restart); |
| 250 |
INSERT INTO t8_restart (SELECT 0, c2, c3, c4, c5 FROM t8_restart); |
| 251 |
INSERT INTO t9_restart (SELECT 0, c2, c3, c4, c5 FROM t9_restart); |
| 252 |
|
| 253 |
SELECT count(*) FROM t1_restart; |
| 254 |
SELECT count(*) FROM t2_restart; |
| 255 |
SELECT count(*) FROM t3_restart; |
| 256 |
SELECT count(*) FROM t4_restart; |
| 257 |
SELECT count(*) FROM t5_restart; |
| 258 |
SELECT count(*) FROM t6_restart; |
| 259 |
SELECT count(*) FROM t7_restart; |
| 260 |
SELECT count(*) FROM t8_restart; |
| 261 |
SELECT count(*) FROM t9_restart; |
| 262 |
|
| 263 |
--echo # |
| 264 |
--echo # Show these tables in information_schema. |
| 265 |
--echo # |
| 266 |
--source suite/innodb/include/show_i_s_tables.inc |
| 267 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 268 |
|
| 269 |
DROP TABLE t1_restart; |
| 270 |
DROP TABLE t2_restart; |
| 271 |
DROP TABLE t3_restart; |
| 272 |
# Table t5_restart will be expanded. |
| 273 |
# Tables t6_restart and t7_restart will be truncated. |
| 274 |
DROP TABLE t8_restart; |
| 275 |
DROP TABLE t9_restart; |
| 276 |
DROP TABLESPACE s1_restart; |
| 277 |
|
| 278 |
--echo # |
| 279 |
--echo # Truncate the remote tablespaces. |
| 280 |
--echo # |
| 281 |
TRUNCATE TABLE t5_restart; |
| 282 |
ALTER TABLE t6_restart TRUNCATE PARTITION p2; |
| 283 |
ALTER TABLE t7_restart TRUNCATE PARTITION p1; |
| 284 |
|
| 285 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 286 |
|
| 287 |
INSERT INTO t5_restart VALUES (1000000000, 'MySQL', 'InnoDB', '2011-11-11', 'Read this after reboot'); |
| 288 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 289 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 290 |
INSERT INTO t5_restart (SELECT 0, c2, c3, c4, c5 FROM t5_restart); |
| 291 |
|
| 292 |
SELECT count(*) FROM t5_restart; |
| 293 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 294 |
SHOW CREATE TABLE t5_restart; |
| 295 |
|
| 296 |
SELECT count(*) FROM t6_restart; |
| 297 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 298 |
SHOW CREATE TABLE t6_restart; |
| 299 |
|
| 300 |
SELECT count(*) FROM t7_restart; |
| 301 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 302 |
SHOW CREATE TABLE t7_restart; |
| 303 |
|
| 304 |
--echo # |
| 305 |
--echo # Shutdown the server and make a backup of a tablespace |
| 306 |
--echo # |
| 307 |
--source include/shutdown_mysqld.inc |
| 308 |
|
| 309 |
--copy_file $ALT_DIR/$SCHEMA_NAME/t5_restart.ibd $ALT_DIR/$SCHEMA_NAME/t5_restart.ibd.bak |
| 310 |
|
| 311 |
--echo ---- MYSQL_DATA_DIR/$SCHEMA_NAME |
| 312 |
--replace_result #P# #p# #SP# #sp# |
| 313 |
--list_files $MYSQL_DATA_DIR/$SCHEMA_NAME |
| 314 |
--echo ---- ALT_DIR/$SCHEMA_NAME |
| 315 |
--replace_result #P# #p# #SP# #sp# |
| 316 |
--list_files $ALT_DIR/$SCHEMA_NAME |
| 317 |
|
| 318 |
--echo # |
| 319 |
--echo # Start the server and show the tablespaces. |
| 320 |
--echo # |
| 321 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 322 |
--source include/start_mysqld.inc |
| 323 |
|
| 324 |
SHOW VARIABLES LIKE 'innodb_file_per_table'; |
| 325 |
|
| 326 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 327 |
|
| 328 |
SELECT count(*) FROM t5_restart; |
| 329 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 330 |
SHOW CREATE TABLE t5_restart; |
| 331 |
|
| 332 |
SELECT count(*) FROM t6_restart; |
| 333 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 334 |
SHOW CREATE TABLE t6_restart; |
| 335 |
|
| 336 |
SELECT count(*) FROM t7_restart; |
| 337 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 338 |
SHOW CREATE TABLE t7_restart; |
| 339 |
|
| 340 |
--echo # |
| 341 |
--echo # Try to rename a tablespace to a file that already exists |
| 342 |
--echo # |
| 343 |
|
| 344 |
--remove_file $ALT_DIR/$SCHEMA_NAME/t5_restart.ibd.bak |
| 345 |
|
| 346 |
--echo ---- MYSQL_DATA_DIR/$SCHEMA_NAME |
| 347 |
--replace_result #P# #p# #SP# #sp# |
| 348 |
--list_files $MYSQL_DATA_DIR/$SCHEMA_NAME |
| 349 |
--echo ---- ALT_DIR/$SCHEMA_NAME |
| 350 |
--replace_result #P# #p# #SP# #sp# |
| 351 |
--list_files $ALT_DIR/$SCHEMA_NAME |
| 352 |
|
| 353 |
--echo # |
| 354 |
--echo # Rename file table and tablespace |
| 355 |
--echo # |
| 356 |
|
| 357 |
RENAME TABLE t5_restart TO t55_restart; |
| 358 |
RENAME TABLE t6_restart TO t66_restart; |
| 359 |
RENAME TABLE t7_restart TO t77_restart; |
| 360 |
|
| 361 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 362 |
|
| 363 |
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); |
| 364 |
SELECT count(*) FROM t55_restart; |
| 365 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 366 |
SHOW CREATE TABLE t55_restart; |
| 367 |
|
| 368 |
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); |
| 369 |
SELECT count(*) FROM t66_restart; |
| 370 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 371 |
SHOW CREATE TABLE t66_restart; |
| 372 |
|
| 373 |
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); |
| 374 |
SELECT count(*) FROM t77_restart; |
| 375 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 376 |
SHOW CREATE TABLE t77_restart; |
| 377 |
|
| 378 |
--echo ---- MYSQL_DATA_DIR/$SCHEMA_NAME |
| 379 |
--replace_result #P# #p# #SP# #sp# |
| 380 |
--list_files $MYSQL_DATA_DIR/$SCHEMA_NAME |
| 381 |
--echo ---- ALT_DIR/$SCHEMA_NAME |
| 382 |
--replace_result #P# #p# #SP# #sp# |
| 383 |
--list_files $ALT_DIR/$SCHEMA_NAME |
| 384 |
|
| 385 |
--echo # |
| 386 |
--echo # Restart the server |
| 387 |
--echo # |
| 388 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 389 |
--source include/restart_mysqld.inc |
| 390 |
SHOW VARIABLES LIKE 'innodb_file_per_table'; |
| 391 |
|
| 392 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 393 |
|
| 394 |
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); |
| 395 |
SELECT count(*) FROM t55_restart; |
| 396 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 397 |
SHOW CREATE TABLE t55_restart; |
| 398 |
|
| 399 |
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); |
| 400 |
SELECT count(*) FROM t66_restart; |
| 401 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 402 |
SHOW CREATE TABLE t66_restart; |
| 403 |
|
| 404 |
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); |
| 405 |
SELECT count(*) FROM t77_restart; |
| 406 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 407 |
SHOW CREATE TABLE t77_restart; |
| 408 |
|
| 409 |
--echo # |
| 410 |
--echo # Shutdown the server |
| 411 |
--echo # |
| 412 |
--source include/shutdown_mysqld.inc |
| 413 |
|
| 414 |
--echo ---- MYSQL_DATA_DIR/$SCHEMA_NAME |
| 415 |
--replace_result #P# #p# #SP# #sp# |
| 416 |
--list_files $MYSQL_DATA_DIR/$SCHEMA_NAME |
| 417 |
--echo ---- ALT_DIR/$SCHEMA_NAME |
| 418 |
--replace_result #P# #p# #SP# #sp# |
| 419 |
--list_files $ALT_DIR/$SCHEMA_NAME |
| 420 |
|
| 421 |
--echo # |
| 422 |
--echo # Start the server and check tablespaces. |
| 423 |
--echo # |
| 424 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 425 |
--source include/start_mysqld.inc |
| 426 |
|
| 427 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 428 |
|
| 429 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 430 |
SELECT count(*) FROM t4_restart; |
| 431 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 432 |
SHOW CREATE TABLE t4_restart; |
| 433 |
|
| 434 |
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); |
| 435 |
SELECT count(*) FROM t55_restart; |
| 436 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 437 |
SHOW CREATE TABLE t55_restart; |
| 438 |
|
| 439 |
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); |
| 440 |
SELECT count(*) FROM t66_restart; |
| 441 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 442 |
SHOW CREATE TABLE t66_restart; |
| 443 |
|
| 444 |
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); |
| 445 |
SELECT count(*) FROM t77_restart; |
| 446 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 447 |
SHOW CREATE TABLE t77_restart; |
| 448 |
|
| 449 |
|
| 450 |
--echo # |
| 451 |
--echo # Shutdown the server |
| 452 |
--echo # |
| 453 |
--source include/shutdown_mysqld.inc |
| 454 |
|
| 455 |
--echo # |
| 456 |
--echo # Start the server and check tablespaces. |
| 457 |
--echo # |
| 458 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 459 |
--source include/start_mysqld.inc |
| 460 |
|
| 461 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 462 |
|
| 463 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 464 |
SELECT count(*) FROM t4_restart; |
| 465 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 466 |
SHOW CREATE TABLE t4_restart; |
| 467 |
|
| 468 |
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); |
| 469 |
SELECT count(*) FROM t55_restart; |
| 470 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 471 |
SHOW CREATE TABLE t55_restart; |
| 472 |
|
| 473 |
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); |
| 474 |
SELECT count(*) FROM t66_restart; |
| 475 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 476 |
SHOW CREATE TABLE t66_restart; |
| 477 |
|
| 478 |
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); |
| 479 |
SELECT count(*) FROM t77_restart; |
| 480 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 481 |
SHOW CREATE TABLE t77_restart; |
| 482 |
|
| 483 |
--echo # |
| 484 |
--echo # Shutdown the server |
| 485 |
--echo # Move all the files form ALT_DIR to ALT_DIR_MOVED |
| 486 |
--echo # |
| 487 |
--source include/shutdown_mysqld.inc |
| 488 |
|
| 489 |
--echo # Moving files |
| 490 |
--mkdir $ALT_DIR_MOVED |
| 491 |
--mkdir $ALT_DIR_MOVED/$SCHEMA_NAME |
| 492 |
--copy_files_wildcard $ALT_DIR/$SCHEMA_NAME $ALT_DIR_MOVED/$SCHEMA_NAME * |
| 493 |
--remove_files_wildcard $ALT_DIR/$SCHEMA_NAME * |
| 494 |
--rmdir $ALT_DIR/$SCHEMA_NAME |
| 495 |
--replace_result #P# #p# #SP# #sp# |
| 496 |
--list_files $ALT_DIR_MOVED/$SCHEMA_NAME |
| 497 |
|
| 498 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 499 |
LET $restart_parameters = restart:--innodb-directories="$ALT_DIR_MOVED"; |
| 500 |
|
| 501 |
--echo # |
| 502 |
--echo # Start the server and check tablespaces. |
| 503 |
--echo # |
| 504 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 505 |
--source include/start_mysqld.inc |
| 506 |
|
| 507 |
INSERT INTO t4_restart (SELECT 0, c2, c3, c4, c5 FROM t4_restart); |
| 508 |
SELECT count(*) FROM t4_restart; |
| 509 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 510 |
SHOW CREATE TABLE t4_restart; |
| 511 |
|
| 512 |
INSERT INTO t55_restart (SELECT 0, c2, c3, c4, c5 FROM t55_restart); |
| 513 |
SELECT count(*) FROM t55_restart; |
| 514 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 515 |
SHOW CREATE TABLE t55_restart; |
| 516 |
|
| 517 |
INSERT INTO t66_restart (SELECT 0, c2, c3, c4, c5 FROM t66_restart); |
| 518 |
SELECT count(*) FROM t66_restart; |
| 519 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 520 |
SHOW CREATE TABLE t66_restart; |
| 521 |
|
| 522 |
INSERT INTO t77_restart (SELECT 0, c2, c3, c4, c5 FROM t77_restart); |
| 523 |
SELECT count(*) FROM t77_restart; |
| 524 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 525 |
SHOW CREATE TABLE t77_restart; |
| 526 |
|
| 527 |
--echo # |
| 528 |
--echo # Show these tables in information_schema with the updated path |
| 529 |
--echo # |
| 530 |
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR |
| 531 |
--source suite/innodb/include/show_i_s_tables.inc |
| 532 |
--source suite/innodb/include/show_i_s_tablespaces.inc |
| 533 |
|
| 534 |
--echo # |
| 535 |
--echo # Cleanup |
| 536 |
--echo # |
| 537 |
|
| 538 |
eval DROP DATABASE $SCHEMA_NAME; |
| 539 |
|
| 540 |
--disable_query_log |
| 541 |
|
| 542 |
# Restart with standard innodb_directories |
| 543 |
--let $restart_parameters= |
| 544 |
--source include/restart_mysqld.inc |
| 545 |
|
| 546 |
--rmdir $ALT_DIR_MOVED/$SCHEMA_NAME |
| 547 |
--rmdir $ALT_DIR_MOVED |
| 548 |
--rmdir $ALT_DIR |
| 549 |
|
| 550 |
eval set global innodb_file_per_table=$innodb_file_per_table_orig; |
| 551 |
--enable_query_log |