| 1 |
# Adding big test option for this test. |
| 2 |
--source include/big_test.inc |
| 3 |
|
| 4 |
# This test case needs to crash the server. Needs a debug server. |
| 5 |
--source include/have_debug.inc |
| 6 |
|
| 7 |
# Don't test this under valgrind, memory leaks will occur. |
| 8 |
--source include/not_valgrind.inc |
| 9 |
|
| 10 |
# Avoid CrashReporter popup on Mac |
| 11 |
--source include/not_crashrep.inc |
| 12 |
|
| 13 |
|
| 14 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 15 |
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`; |
| 16 |
let $strerrfix=/ (\(.+\))//; |
| 17 |
|
| 18 |
SET GLOBAL innodb_file_per_table = 1; |
| 19 |
SELECT @@innodb_file_per_table; |
| 20 |
|
| 21 |
DROP DATABASE IF EXISTS test_wl5522; |
| 22 |
CREATE DATABASE test_wl5522; |
| 23 |
|
| 24 |
##### Before DISCARD commit crash |
| 25 |
SET SESSION debug="+d,ib_discard_before_commit_crash"; |
| 26 |
|
| 27 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; |
| 28 |
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); |
| 29 |
|
| 30 |
# Write file to make mysql-test-run.pl start up the server again |
| 31 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 32 |
|
| 33 |
# Execute the statement that causes the crash |
| 34 |
--error 2013 |
| 35 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 36 |
|
| 37 |
--enable_reconnect |
| 38 |
--source include/wait_until_connected_again.inc |
| 39 |
--disable_reconnect |
| 40 |
|
| 41 |
SET SESSION debug="-d,ib_discard_before_commit_crash"; |
| 42 |
DROP TABLE test_wl5522.t1; |
| 43 |
#### Before DISCARD commit crash |
| 44 |
|
| 45 |
##### After DISCARD commit crash |
| 46 |
SET GLOBAL innodb_file_per_table = 1; |
| 47 |
SELECT @@innodb_file_per_table; |
| 48 |
|
| 49 |
SET SESSION debug="+d,ib_discard_after_commit_crash"; |
| 50 |
|
| 51 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = InnoDB; |
| 52 |
INSERT INTO test_wl5522.t1 VALUES(1),(2),(3); |
| 53 |
|
| 54 |
# Write file to make mysql-test-run.pl start up the server again |
| 55 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 56 |
|
| 57 |
# Execute the statement that causes the crash |
| 58 |
--error 2013 |
| 59 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 60 |
|
| 61 |
--enable_reconnect |
| 62 |
--source include/wait_until_connected_again.inc |
| 63 |
--disable_reconnect |
| 64 |
|
| 65 |
SET SESSION debug="-d,ib_discard_after_commit_crash"; |
| 66 |
DROP TABLE test_wl5522.t1; |
| 67 |
#### After DISCARD commit crash |
| 68 |
|
| 69 |
SET GLOBAL innodb_file_per_table = 1; |
| 70 |
SELECT @@innodb_file_per_table; |
| 71 |
|
| 72 |
# Create the table that we will use for crash recovery (during IMPORT) |
| 73 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 74 |
INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4); |
| 75 |
|
| 76 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 77 |
|
| 78 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 79 |
|
| 80 |
perl; |
| 81 |
require 'include/innodb-util.inc'; |
| 82 |
ib_backup_tablespaces("test_wl5522", "t1"); |
| 83 |
EOF |
| 84 |
UNLOCK TABLES; |
| 85 |
|
| 86 |
DROP TABLE test_wl5522.t1; |
| 87 |
|
| 88 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 89 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 90 |
|
| 91 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 92 |
|
| 93 |
--error ER_TABLESPACE_DISCARDED |
| 94 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 95 |
|
| 96 |
# Restore files |
| 97 |
perl; |
| 98 |
require 'include/innodb-util.inc'; |
| 99 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 100 |
EOF |
| 101 |
|
| 102 |
##### Before commit crash |
| 103 |
SET SESSION debug="+d,ib_import_before_commit_crash"; |
| 104 |
|
| 105 |
--error ER_TABLESPACE_DISCARDED |
| 106 |
SELECT * FROM test_wl5522.t1; |
| 107 |
|
| 108 |
# Write file to make mysql-test-run.pl start up the server again |
| 109 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 110 |
|
| 111 |
# Execute the statement that causes the crash |
| 112 |
--error 2013 |
| 113 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 114 |
|
| 115 |
perl; |
| 116 |
require 'include/innodb-util.inc'; |
| 117 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 118 |
EOF |
| 119 |
|
| 120 |
--enable_reconnect |
| 121 |
--source include/wait_until_connected_again.inc |
| 122 |
--disable_reconnect |
| 123 |
|
| 124 |
SET SESSION debug="-d,ib_import_before_commit_crash"; |
| 125 |
#### Before commit crash |
| 126 |
|
| 127 |
# Check that the DD is consistent after recovery |
| 128 |
|
| 129 |
##### Before checkpoint crash |
| 130 |
SET SESSION debug="+d,ib_import_before_checkpoint_crash"; |
| 131 |
|
| 132 |
--error ER_TABLESPACE_DISCARDED |
| 133 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 134 |
|
| 135 |
# Don't start up the server right away. |
| 136 |
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 137 |
|
| 138 |
# Execute the statement that causes the crash |
| 139 |
--error 2013 |
| 140 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 141 |
|
| 142 |
# After the above test the results are non-deterministic, |
| 143 |
# delete the old tablespace files and drop the table, |
| 144 |
# recreate the table and do a proper import. |
| 145 |
-- source include/wait_until_disconnected.inc |
| 146 |
|
| 147 |
perl; |
| 148 |
require 'include/innodb-util.inc'; |
| 149 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 150 |
EOF |
| 151 |
|
| 152 |
--echo # Restart and reconnect to the server |
| 153 |
--enable_reconnect |
| 154 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 155 |
--source include/wait_until_connected_again.inc |
| 156 |
--disable_reconnect |
| 157 |
|
| 158 |
SET SESSION debug="-d,ib_import_before_checkpoint_crash"; |
| 159 |
#### Before checkpoint crash |
| 160 |
|
| 161 |
# After the above test the results are non-deterministic, recreate the table |
| 162 |
# and do a proper import. |
| 163 |
|
| 164 |
DROP TABLE test_wl5522.t1; |
| 165 |
|
| 166 |
SET GLOBAL innodb_file_per_table = 1; |
| 167 |
SELECT @@innodb_file_per_table; |
| 168 |
|
| 169 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 170 |
|
| 171 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 172 |
|
| 173 |
perl; |
| 174 |
require 'include/innodb-util.inc'; |
| 175 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 176 |
EOF |
| 177 |
|
| 178 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 179 |
CHECK TABLE test_wl5522.t1; |
| 180 |
|
| 181 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 182 |
|
| 183 |
INSERT INTO test_wl5522.t1 VALUES(400), (500), (600); |
| 184 |
|
| 185 |
SELECT * FROM test_wl5522.t1; |
| 186 |
|
| 187 |
DROP TABLE test_wl5522.t1; |
| 188 |
|
| 189 |
# Test IO Write error(s), flush tables doesn't return an error message |
| 190 |
# so we have to make do with the error/warning pushed by the server |
| 191 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 192 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 193 |
|
| 194 |
SET SESSION debug="+d,ib_export_io_write_failure_1"; |
| 195 |
|
| 196 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 197 |
|
| 198 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 199 |
|
| 200 |
UNLOCK TABLES; |
| 201 |
|
| 202 |
SET SESSION debug="-d,ib_export_io_write_failure_1"; |
| 203 |
|
| 204 |
DROP TABLE test_wl5522.t1; |
| 205 |
|
| 206 |
|
| 207 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 208 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 209 |
|
| 210 |
SET SESSION debug="+d,ib_export_io_write_failure_2"; |
| 211 |
|
| 212 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 213 |
|
| 214 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 215 |
|
| 216 |
UNLOCK TABLES; |
| 217 |
|
| 218 |
SET SESSION debug="-d,ib_export_io_write_failure_2"; |
| 219 |
|
| 220 |
DROP TABLE test_wl5522.t1; |
| 221 |
|
| 222 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 223 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 224 |
|
| 225 |
SET SESSION debug="+d,ib_export_io_write_failure_3"; |
| 226 |
|
| 227 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 228 |
|
| 229 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 230 |
|
| 231 |
UNLOCK TABLES; |
| 232 |
|
| 233 |
SET SESSION debug="-d,ib_export_io_write_failure_3"; |
| 234 |
|
| 235 |
DROP TABLE test_wl5522.t1; |
| 236 |
|
| 237 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 238 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 239 |
|
| 240 |
SET SESSION debug="+d,ib_export_io_write_failure_4"; |
| 241 |
|
| 242 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 243 |
|
| 244 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 245 |
|
| 246 |
UNLOCK TABLES; |
| 247 |
|
| 248 |
SET SESSION debug="-d,ib_export_io_write_failure_4"; |
| 249 |
|
| 250 |
DROP TABLE test_wl5522.t1; |
| 251 |
|
| 252 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 253 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 254 |
|
| 255 |
SET SESSION debug="+d,ib_export_io_write_failure_5"; |
| 256 |
|
| 257 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 258 |
|
| 259 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 260 |
|
| 261 |
UNLOCK TABLES; |
| 262 |
|
| 263 |
SET SESSION debug="-d,ib_export_io_write_failure_5"; |
| 264 |
|
| 265 |
DROP TABLE test_wl5522.t1; |
| 266 |
|
| 267 |
|
| 268 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 269 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 270 |
|
| 271 |
SET SESSION debug="+d,ib_export_io_write_failure_6"; |
| 272 |
|
| 273 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 274 |
|
| 275 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 276 |
|
| 277 |
UNLOCK TABLES; |
| 278 |
|
| 279 |
SET SESSION debug="-d,ib_export_io_write_failure_6"; |
| 280 |
|
| 281 |
DROP TABLE test_wl5522.t1; |
| 282 |
|
| 283 |
|
| 284 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 285 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 286 |
|
| 287 |
SET SESSION debug="+d,ib_export_io_write_failure_7"; |
| 288 |
|
| 289 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 290 |
|
| 291 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 292 |
|
| 293 |
UNLOCK TABLES; |
| 294 |
|
| 295 |
SET SESSION debug="-d,ib_export_io_write_failure_7"; |
| 296 |
|
| 297 |
DROP TABLE test_wl5522.t1; |
| 298 |
|
| 299 |
|
| 300 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 301 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 302 |
|
| 303 |
SET SESSION debug="+d,ib_export_io_write_failure_8"; |
| 304 |
|
| 305 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 306 |
|
| 307 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 308 |
|
| 309 |
UNLOCK TABLES; |
| 310 |
|
| 311 |
SET SESSION debug="-d,ib_export_io_write_failure_8"; |
| 312 |
|
| 313 |
DROP TABLE test_wl5522.t1; |
| 314 |
|
| 315 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 316 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 317 |
|
| 318 |
SET SESSION debug="+d,ib_export_io_write_failure_9"; |
| 319 |
|
| 320 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 321 |
|
| 322 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 323 |
|
| 324 |
UNLOCK TABLES; |
| 325 |
|
| 326 |
SET SESSION debug="-d,ib_export_io_write_failure_9"; |
| 327 |
|
| 328 |
DROP TABLE test_wl5522.t1; |
| 329 |
|
| 330 |
|
| 331 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 332 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 333 |
|
| 334 |
SET SESSION debug="+d,ib_export_io_write_failure_10"; |
| 335 |
|
| 336 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 337 |
|
| 338 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 339 |
|
| 340 |
UNLOCK TABLES; |
| 341 |
|
| 342 |
SET SESSION debug="-d,ib_export_io_write_failure_10"; |
| 343 |
|
| 344 |
DROP TABLE test_wl5522.t1; |
| 345 |
|
| 346 |
|
| 347 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 348 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 349 |
|
| 350 |
SET SESSION debug="+d,ib_export_io_write_failure_11"; |
| 351 |
|
| 352 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 353 |
|
| 354 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 355 |
|
| 356 |
UNLOCK TABLES; |
| 357 |
|
| 358 |
SET SESSION debug="-d,ib_export_io_write_failure_11"; |
| 359 |
|
| 360 |
DROP TABLE test_wl5522.t1; |
| 361 |
|
| 362 |
|
| 363 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 364 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 365 |
|
| 366 |
SET SESSION debug="+d,ib_export_io_write_failure_12"; |
| 367 |
|
| 368 |
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ |
| 369 |
|
| 370 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 371 |
|
| 372 |
UNLOCK TABLES; |
| 373 |
|
| 374 |
SET SESSION debug="-d,ib_export_io_write_failure_12"; |
| 375 |
|
| 376 |
DROP TABLE test_wl5522.t1; |
| 377 |
|
| 378 |
# Create a table and save the tablespace and .cfg file |
| 379 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 380 |
INSERT INTO test_wl5522.t1 VALUES (100), (200), (300); |
| 381 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 382 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 383 |
|
| 384 |
perl; |
| 385 |
require 'include/innodb-util.inc'; |
| 386 |
ib_backup_tablespaces("test_wl5522", "t1"); |
| 387 |
EOF |
| 388 |
|
| 389 |
UNLOCK TABLES; |
| 390 |
|
| 391 |
DROP TABLE test_wl5522.t1; |
| 392 |
|
| 393 |
# Test IO Read error(s) |
| 394 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 395 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 396 |
|
| 397 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 398 |
|
| 399 |
--error ER_TABLESPACE_DISCARDED |
| 400 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 401 |
|
| 402 |
SET SESSION debug="+d,ib_import_io_read_error_1"; |
| 403 |
|
| 404 |
perl; |
| 405 |
require 'include/innodb-util.inc'; |
| 406 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 407 |
EOF |
| 408 |
|
| 409 |
--replace_regex $strerrfix |
| 410 |
|
| 411 |
--error ER_IO_READ_ERROR |
| 412 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 413 |
|
| 414 |
SET SESSION debug="-d,ib_import_io_read_error_1"; |
| 415 |
|
| 416 |
DROP TABLE test_wl5522.t1; |
| 417 |
|
| 418 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 419 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 420 |
|
| 421 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 422 |
|
| 423 |
--error ER_TABLESPACE_DISCARDED |
| 424 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 425 |
|
| 426 |
SET SESSION debug="+d,ib_import_io_read_error_2"; |
| 427 |
|
| 428 |
perl; |
| 429 |
require 'include/innodb-util.inc'; |
| 430 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 431 |
EOF |
| 432 |
|
| 433 |
--replace_regex $strerrfix |
| 434 |
|
| 435 |
--error ER_IO_READ_ERROR |
| 436 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 437 |
|
| 438 |
SET SESSION debug="-d,ib_import_io_read_error_2"; |
| 439 |
|
| 440 |
DROP TABLE test_wl5522.t1; |
| 441 |
|
| 442 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 443 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 444 |
|
| 445 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 446 |
|
| 447 |
--error ER_TABLESPACE_DISCARDED |
| 448 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 449 |
|
| 450 |
SET SESSION debug="+d,ib_import_io_read_error_3"; |
| 451 |
|
| 452 |
perl; |
| 453 |
require 'include/innodb-util.inc'; |
| 454 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 455 |
EOF |
| 456 |
|
| 457 |
--replace_regex $strerrfix |
| 458 |
|
| 459 |
--error ER_IO_READ_ERROR |
| 460 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 461 |
|
| 462 |
SET SESSION debug="-d,ib_import_io_read_error_3"; |
| 463 |
|
| 464 |
DROP TABLE test_wl5522.t1; |
| 465 |
|
| 466 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 467 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 468 |
|
| 469 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 470 |
|
| 471 |
--error ER_TABLESPACE_DISCARDED |
| 472 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 473 |
|
| 474 |
SET SESSION debug="+d,ib_import_io_read_error_4"; |
| 475 |
|
| 476 |
perl; |
| 477 |
require 'include/innodb-util.inc'; |
| 478 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 479 |
EOF |
| 480 |
|
| 481 |
--replace_regex $strerrfix |
| 482 |
|
| 483 |
--error ER_IO_READ_ERROR |
| 484 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 485 |
|
| 486 |
SET SESSION debug="-d,ib_import_io_read_error_4"; |
| 487 |
|
| 488 |
DROP TABLE test_wl5522.t1; |
| 489 |
|
| 490 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 491 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 492 |
|
| 493 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 494 |
|
| 495 |
--error ER_TABLESPACE_DISCARDED |
| 496 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 497 |
|
| 498 |
SET SESSION debug="+d,ib_import_io_read_error_5"; |
| 499 |
|
| 500 |
perl; |
| 501 |
require 'include/innodb-util.inc'; |
| 502 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 503 |
EOF |
| 504 |
|
| 505 |
--replace_regex $strerrfix |
| 506 |
|
| 507 |
--error ER_IO_READ_ERROR |
| 508 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 509 |
|
| 510 |
SET SESSION debug="-d,ib_import_io_read_error_5"; |
| 511 |
|
| 512 |
DROP TABLE test_wl5522.t1; |
| 513 |
|
| 514 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 515 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 516 |
|
| 517 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 518 |
|
| 519 |
--error ER_TABLESPACE_DISCARDED |
| 520 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 521 |
|
| 522 |
SET SESSION debug="+d,ib_import_io_read_error_6"; |
| 523 |
|
| 524 |
perl; |
| 525 |
require 'include/innodb-util.inc'; |
| 526 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 527 |
EOF |
| 528 |
|
| 529 |
--replace_regex $strerrfix |
| 530 |
|
| 531 |
--error ER_IO_READ_ERROR |
| 532 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 533 |
|
| 534 |
SET SESSION debug="-d,ib_import_io_read_error_6"; |
| 535 |
|
| 536 |
DROP TABLE test_wl5522.t1; |
| 537 |
|
| 538 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 539 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 540 |
|
| 541 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 542 |
|
| 543 |
--error ER_TABLESPACE_DISCARDED |
| 544 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 545 |
|
| 546 |
SET SESSION debug="+d,ib_import_io_read_error_7"; |
| 547 |
|
| 548 |
perl; |
| 549 |
require 'include/innodb-util.inc'; |
| 550 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 551 |
EOF |
| 552 |
|
| 553 |
--replace_regex $strerrfix |
| 554 |
|
| 555 |
--error ER_IO_READ_ERROR |
| 556 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 557 |
|
| 558 |
SET SESSION debug="-d,ib_import_io_read_error_7"; |
| 559 |
|
| 560 |
DROP TABLE test_wl5522.t1; |
| 561 |
|
| 562 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 563 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 564 |
|
| 565 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 566 |
|
| 567 |
--error ER_TABLESPACE_DISCARDED |
| 568 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 569 |
|
| 570 |
SET SESSION debug="+d,ib_import_io_read_error_8"; |
| 571 |
|
| 572 |
perl; |
| 573 |
require 'include/innodb-util.inc'; |
| 574 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 575 |
EOF |
| 576 |
|
| 577 |
--replace_regex $strerrfix |
| 578 |
|
| 579 |
--error ER_IO_READ_ERROR |
| 580 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 581 |
|
| 582 |
SET SESSION debug="-d,ib_import_io_read_error_8"; |
| 583 |
|
| 584 |
DROP TABLE test_wl5522.t1; |
| 585 |
|
| 586 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 587 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 588 |
|
| 589 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 590 |
|
| 591 |
--error ER_TABLESPACE_DISCARDED |
| 592 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 593 |
|
| 594 |
SET SESSION debug="+d,ib_import_io_read_error_9"; |
| 595 |
|
| 596 |
perl; |
| 597 |
require 'include/innodb-util.inc'; |
| 598 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 599 |
EOF |
| 600 |
|
| 601 |
--replace_regex $strerrfix |
| 602 |
|
| 603 |
--error ER_IO_READ_ERROR |
| 604 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 605 |
|
| 606 |
SET SESSION debug="-d,ib_import_io_read_error_9"; |
| 607 |
|
| 608 |
DROP TABLE test_wl5522.t1; |
| 609 |
|
| 610 |
# Test string read failure |
| 611 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 612 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 613 |
|
| 614 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 615 |
|
| 616 |
--error ER_TABLESPACE_DISCARDED |
| 617 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 618 |
|
| 619 |
SET SESSION debug="+d,ib_import_string_read_error"; |
| 620 |
|
| 621 |
perl; |
| 622 |
require 'include/innodb-util.inc'; |
| 623 |
ib_restore_cfg_files("test_wl5522", "t1"); |
| 624 |
EOF |
| 625 |
|
| 626 |
--replace_regex $strerrfix |
| 627 |
|
| 628 |
--error ER_IO_READ_ERROR |
| 629 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 630 |
|
| 631 |
SET SESSION debug="-d,ib_import_string_read_error"; |
| 632 |
|
| 633 |
DROP TABLE test_wl5522.t1; |
| 634 |
|
| 635 |
# Test OOM error during import |
| 636 |
|
| 637 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 638 |
INSERT INTO test_wl5522.t1 VALUES (1); |
| 639 |
|
| 640 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 641 |
|
| 642 |
--error ER_TABLESPACE_DISCARDED |
| 643 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 644 |
|
| 645 |
# Restore files |
| 646 |
perl; |
| 647 |
require 'include/innodb-util.inc'; |
| 648 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 649 |
EOF |
| 650 |
|
| 651 |
|
| 652 |
let DBUG_CRASH_POINT = ib_import_OOM_1; |
| 653 |
--source ../include/transportable_tbsp_oom.inc |
| 654 |
|
| 655 |
let DBUG_CRASH_POINT = ib_import_OOM_2; |
| 656 |
--source ../include/transportable_tbsp_oom.inc |
| 657 |
|
| 658 |
let DBUG_CRASH_POINT = ib_import_OOM_4; |
| 659 |
--source ../include/transportable_tbsp_oom.inc |
| 660 |
|
| 661 |
let DBUG_CRASH_POINT = ib_import_OOM_5; |
| 662 |
--source ../include/transportable_tbsp_oom.inc |
| 663 |
|
| 664 |
let DBUG_CRASH_POINT = ib_import_OOM_6; |
| 665 |
--source ../include/transportable_tbsp_oom.inc |
| 666 |
|
| 667 |
let DBUG_CRASH_POINT = ib_import_OOM_7; |
| 668 |
--source ../include/transportable_tbsp_oom.inc |
| 669 |
|
| 670 |
let DBUG_CRASH_POINT = ib_import_OOM_8; |
| 671 |
--source ../include/transportable_tbsp_oom.inc |
| 672 |
|
| 673 |
let DBUG_CRASH_POINT = ib_import_OOM_9; |
| 674 |
--source ../include/transportable_tbsp_oom.inc |
| 675 |
|
| 676 |
let DBUG_CRASH_POINT = ib_import_OOM_10; |
| 677 |
--source ../include/transportable_tbsp_oom.inc |
| 678 |
|
| 679 |
let DBUG_CRASH_POINT = ib_import_OOM_15; |
| 680 |
--source ../include/transportable_tbsp_oom.inc |
| 681 |
|
| 682 |
|
| 683 |
DROP TABLE test_wl5522.t1; |
| 684 |
|
| 685 |
perl; |
| 686 |
require 'include/innodb-util.inc'; |
| 687 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 688 |
EOF |
| 689 |
|
| 690 |
|
| 691 |
#### |
| 692 |
# Test handling of internal failure error |
| 693 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 694 |
|
| 695 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 696 |
|
| 697 |
--error ER_TABLESPACE_DISCARDED |
| 698 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 699 |
|
| 700 |
# Restore files |
| 701 |
perl; |
| 702 |
require 'include/innodb-util.inc'; |
| 703 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 704 |
EOF |
| 705 |
|
| 706 |
# Test failure after reset of space id and LSN in the tablespace |
| 707 |
SET SESSION debug="+d,ib_import_internal_error"; |
| 708 |
|
| 709 |
--replace_regex /'.*t1.cfg'/'t1.cfg'/ |
| 710 |
|
| 711 |
--error ER_INTERNAL_ERROR |
| 712 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 713 |
|
| 714 |
SET SESSION debug="-d,ib_import_internal_error"; |
| 715 |
|
| 716 |
# Restore files |
| 717 |
perl; |
| 718 |
require 'include/innodb-util.inc'; |
| 719 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 720 |
EOF |
| 721 |
|
| 722 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 723 |
|
| 724 |
DROP TABLE test_wl5522.t1; |
| 725 |
|
| 726 |
|
| 727 |
# Test failure after reset of space id and LSN in the tablespace |
| 728 |
CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb; |
| 729 |
|
| 730 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 731 |
|
| 732 |
--error ER_TABLESPACE_DISCARDED |
| 733 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 734 |
|
| 735 |
# Restore files |
| 736 |
perl; |
| 737 |
require 'include/innodb-util.inc'; |
| 738 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 739 |
EOF |
| 740 |
|
| 741 |
# Test failure after reset of space id and LSN in the tablespace |
| 742 |
SET SESSION debug="+d,ib_import_reset_space_and_lsn_failure"; |
| 743 |
|
| 744 |
--replace_regex /'.*t1.cfg'/'t1.cfg'/ |
| 745 |
|
| 746 |
--error ER_INTERNAL_ERROR |
| 747 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 748 |
|
| 749 |
# Restore files |
| 750 |
perl; |
| 751 |
require 'include/innodb-util.inc'; |
| 752 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 753 |
EOF |
| 754 |
|
| 755 |
SET SESSION debug="-d,ib_import_reset_space_and_lsn_failure"; |
| 756 |
|
| 757 |
# Test failure after attempting a tablespace open |
| 758 |
SET SESSION debug="+d,ib_import_open_tablespace_failure"; |
| 759 |
|
| 760 |
--replace_regex /file: '.*t1.ibd'/'t1.ibd'/ |
| 761 |
|
| 762 |
--error ER_FILE_NOT_FOUND |
| 763 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 764 |
|
| 765 |
SET SESSION debug="-d,ib_import_open_tablespace_failure"; |
| 766 |
|
| 767 |
# Restore files |
| 768 |
perl; |
| 769 |
require 'include/innodb-util.inc'; |
| 770 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 771 |
EOF |
| 772 |
|
| 773 |
# Test failure after ibuf check |
| 774 |
SET SESSION debug="+d,ib_import_check_bitmap_failure"; |
| 775 |
|
| 776 |
# Need proper mapping of error codes :-( |
| 777 |
--error ER_NOT_KEYFILE |
| 778 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 779 |
|
| 780 |
SET SESSION debug="-d,ib_import_check_bitmap_failure"; |
| 781 |
|
| 782 |
# Restore files |
| 783 |
perl; |
| 784 |
require 'include/innodb-util.inc'; |
| 785 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 786 |
EOF |
| 787 |
|
| 788 |
# Test failure after adjusting the cluster index root page |
| 789 |
SET SESSION debug="+d,ib_import_cluster_root_adjust_failure"; |
| 790 |
|
| 791 |
--error ER_NOT_KEYFILE |
| 792 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 793 |
|
| 794 |
SET SESSION debug="-d,ib_import_cluster_root_adjust_failure"; |
| 795 |
|
| 796 |
# Restore files |
| 797 |
perl; |
| 798 |
require 'include/innodb-util.inc'; |
| 799 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 800 |
EOF |
| 801 |
|
| 802 |
# Test failure after importing the cluster index |
| 803 |
SET SESSION debug="+d,ib_import_cluster_failure"; |
| 804 |
|
| 805 |
--error ER_NOT_KEYFILE |
| 806 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 807 |
|
| 808 |
SET SESSION debug="-d,ib_import_cluster_failure"; |
| 809 |
|
| 810 |
# Restore files |
| 811 |
perl; |
| 812 |
require 'include/innodb-util.inc'; |
| 813 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 814 |
EOF |
| 815 |
|
| 816 |
# Test failure after importing the secondary index(es) |
| 817 |
SET SESSION debug="+d,ib_import_sec_root_adjust_failure"; |
| 818 |
|
| 819 |
--error ER_NOT_KEYFILE |
| 820 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 821 |
|
| 822 |
SET SESSION debug="-d,ib_import_sec_root_adjust_failure"; |
| 823 |
|
| 824 |
# Restore files |
| 825 |
perl; |
| 826 |
require 'include/innodb-util.inc'; |
| 827 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 828 |
EOF |
| 829 |
|
| 830 |
# Test failure after importing the cluster index |
| 831 |
SET SESSION debug="+d,ib_import_set_max_rowid_failure"; |
| 832 |
|
| 833 |
--error ER_NOT_KEYFILE |
| 834 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 835 |
|
| 836 |
SET SESSION debug="-d,ib_import_set_max_rowid_failure"; |
| 837 |
|
| 838 |
# Left over from the failed IMPORT |
| 839 |
perl; |
| 840 |
require 'include/innodb-util.inc'; |
| 841 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 842 |
EOF |
| 843 |
|
| 844 |
DROP TABLE test_wl5522.t1; |
| 845 |
|
| 846 |
--disable_query_log |
| 847 |
# Enable metrics for the counters we are going to use |
| 848 |
set global innodb_monitor_enable = purge_stop_count; |
| 849 |
set global innodb_monitor_enable = purge_resume_count; |
| 850 |
set global innodb_monitor_enable = ibuf_merges; |
| 851 |
set global innodb_monitor_enable = ibuf_merges_insert; |
| 852 |
--enable_query_log |
| 853 |
|
| 854 |
# |
| 855 |
# Create a large table with delete marked records, disable purge during |
| 856 |
# the update so that we can test the IMPORT purge code. |
| 857 |
# |
| 858 |
CREATE TABLE test_wl5522.t1 ( |
| 859 |
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
| 860 |
c2 BIGINT, |
| 861 |
c3 VARCHAR(2048), |
| 862 |
c4 VARCHAR(2048), |
| 863 |
INDEX idx1(c2), |
| 864 |
INDEX idx2(c3(512)), |
| 865 |
INDEX idx3(c4(512))) Engine=InnoDB Charset=latin1; |
| 866 |
|
| 867 |
# Stop purge so that it doesn't remove the delete marked entries. |
| 868 |
SET GLOBAL INNODB_PURGE_STOP_NOW=ON; |
| 869 |
|
| 870 |
# Disable change buffer merge from the master thread, additionally |
| 871 |
# enable aggressive flushing so that more changes are buffered. |
| 872 |
SET GLOBAL innodb_disable_background_merge=ON; |
| 873 |
SET GLOBAL innodb_monitor_reset = ibuf_merges; |
| 874 |
SET GLOBAL innodb_monitor_reset = ibuf_merges_insert; |
| 875 |
|
| 876 |
INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES |
| 877 |
(1, REPEAT('a', 2048), REPEAT('a', 2048)), |
| 878 |
(2, REPEAT('b', 2048), REPEAT('b', 2048)), |
| 879 |
(3, REPEAT('c', 2048), REPEAT('c', 2048)), |
| 880 |
(4, REPEAT('d', 2048), REPEAT('d', 2048)); |
| 881 |
|
| 882 |
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; |
| 883 |
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; |
| 884 |
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; |
| 885 |
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; |
| 886 |
INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; |
| 887 |
|
| 888 |
DELETE FROM test_wl5522.t1 WHERE c2 = 1; |
| 889 |
|
| 890 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 891 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 892 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 893 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 894 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 895 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 896 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 897 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 898 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 899 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 900 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 901 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 902 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 903 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 904 |
UPDATE test_wl5522.t1 SET c2 = c2 + c1; |
| 905 |
UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024); |
| 906 |
UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024); |
| 907 |
|
| 908 |
SHOW CREATE TABLE test_wl5522.t1; |
| 909 |
|
| 910 |
SELECT c1, c2 FROM test_wl5522.t1; |
| 911 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 912 |
SELECT SUM(c2) FROM test_wl5522.t1; |
| 913 |
|
| 914 |
SELECT name |
| 915 |
FROM information_schema.innodb_metrics |
| 916 |
WHERE name = 'ibuf_merges_insert' AND count = 0; |
| 917 |
|
| 918 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 919 |
|
| 920 |
perl; |
| 921 |
require 'include/innodb-util.inc'; |
| 922 |
ib_backup_tablespaces("test_wl5522", "t1"); |
| 923 |
EOF |
| 924 |
|
| 925 |
UNLOCK TABLES; |
| 926 |
|
| 927 |
SELECT name |
| 928 |
FROM information_schema.innodb_metrics |
| 929 |
WHERE name = 'ibuf_merges' AND count > 0; |
| 930 |
|
| 931 |
SELECT name |
| 932 |
FROM information_schema.innodb_metrics |
| 933 |
WHERE name = 'ibuf_merges_inserts' AND count > 0; |
| 934 |
|
| 935 |
SET GLOBAL innodb_disable_background_merge=OFF; |
| 936 |
|
| 937 |
# Enable normal operation |
| 938 |
SET GLOBAL INNODB_PURGE_RUN_NOW=ON; |
| 939 |
|
| 940 |
DROP TABLE test_wl5522.t1; |
| 941 |
|
| 942 |
CREATE TABLE test_wl5522.t1 ( |
| 943 |
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
| 944 |
c2 BIGINT, |
| 945 |
c3 VARCHAR(2048), |
| 946 |
c4 VARCHAR(2048), |
| 947 |
INDEX idx1(c2), |
| 948 |
INDEX idx2(c3(512)), |
| 949 |
INDEX idx3(c4(512))) Engine=InnoDB Charset=latin1; |
| 950 |
|
| 951 |
SELECT c1, c2 FROM test_wl5522.t1; |
| 952 |
|
| 953 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 954 |
|
| 955 |
perl; |
| 956 |
require 'include/innodb-util.inc'; |
| 957 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 958 |
EOF |
| 959 |
|
| 960 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 961 |
CHECK TABLE test_wl5522.t1; |
| 962 |
|
| 963 |
SELECT c1,c2 FROM test_wl5522.t1; |
| 964 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 965 |
SELECT SUM(c2) FROM test_wl5522.t1; |
| 966 |
|
| 967 |
SHOW CREATE TABLE test_wl5522.t1; |
| 968 |
|
| 969 |
DROP TABLE test_wl5522.t1; |
| 970 |
|
| 971 |
#### |
| 972 |
# Create a table and save the tablespace and .cfg file, we need to create |
| 973 |
# a Btree that has several levels |
| 974 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 975 |
|
| 976 |
INSERT IGNORE INTO test_wl5522.t1 VALUES |
| 977 |
(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 4800)); |
| 978 |
|
| 979 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 980 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 981 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 982 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 983 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 984 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 985 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 986 |
INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1; |
| 987 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 988 |
FLUSH TABLES test_wl5522.t1 FOR EXPORT; |
| 989 |
|
| 990 |
perl; |
| 991 |
require 'include/innodb-util.inc'; |
| 992 |
ib_backup_tablespaces("test_wl5522", "t1"); |
| 993 |
EOF |
| 994 |
|
| 995 |
UNLOCK TABLES; |
| 996 |
|
| 997 |
DROP TABLE test_wl5522.t1; |
| 998 |
|
| 999 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1000 |
|
| 1001 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1002 |
|
| 1003 |
--error ER_TABLESPACE_DISCARDED |
| 1004 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1005 |
|
| 1006 |
# Restore files |
| 1007 |
perl; |
| 1008 |
require 'include/innodb-util.inc'; |
| 1009 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1010 |
EOF |
| 1011 |
|
| 1012 |
SET SESSION debug="+d,ib_import_trigger_corruption_1"; |
| 1013 |
|
| 1014 |
--replace_regex /'.*t1.cfg'/'t1.cfg'/ |
| 1015 |
|
| 1016 |
--error ER_INTERNAL_ERROR |
| 1017 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1018 |
|
| 1019 |
SET SESSION debug="-d,ib_import_trigger_corruption_1"; |
| 1020 |
|
| 1021 |
DROP TABLE test_wl5522.t1; |
| 1022 |
|
| 1023 |
perl; |
| 1024 |
require 'include/innodb-util.inc'; |
| 1025 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1026 |
EOF |
| 1027 |
|
| 1028 |
# |
| 1029 |
|
| 1030 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1031 |
|
| 1032 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1033 |
|
| 1034 |
--error ER_TABLESPACE_DISCARDED |
| 1035 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1036 |
|
| 1037 |
# Restore files |
| 1038 |
perl; |
| 1039 |
require 'include/innodb-util.inc'; |
| 1040 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1041 |
EOF |
| 1042 |
|
| 1043 |
SET SESSION debug="+d,buf_page_import_corrupt_failure"; |
| 1044 |
|
| 1045 |
--replace_regex /'.*t1.cfg'/'t1.cfg'/ |
| 1046 |
|
| 1047 |
--error ER_INTERNAL_ERROR |
| 1048 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1049 |
|
| 1050 |
SET SESSION debug="-d,buf_page_import_corrupt_failure"; |
| 1051 |
|
| 1052 |
DROP TABLE test_wl5522.t1; |
| 1053 |
|
| 1054 |
perl; |
| 1055 |
require 'include/innodb-util.inc'; |
| 1056 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1057 |
EOF |
| 1058 |
|
| 1059 |
# |
| 1060 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1061 |
|
| 1062 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1063 |
|
| 1064 |
--error ER_TABLESPACE_DISCARDED |
| 1065 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1066 |
|
| 1067 |
# Restore files |
| 1068 |
perl; |
| 1069 |
require 'include/innodb-util.inc'; |
| 1070 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1071 |
EOF |
| 1072 |
|
| 1073 |
SET SESSION debug="+d,ib_import_trigger_corruption_2"; |
| 1074 |
|
| 1075 |
--error ER_INNODB_INDEX_CORRUPT |
| 1076 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1077 |
|
| 1078 |
SET SESSION debug="-d,ib_import_trigger_corruption_2"; |
| 1079 |
|
| 1080 |
DROP TABLE test_wl5522.t1; |
| 1081 |
|
| 1082 |
perl; |
| 1083 |
require 'include/innodb-util.inc'; |
| 1084 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1085 |
EOF |
| 1086 |
# |
| 1087 |
|
| 1088 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1089 |
|
| 1090 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1091 |
|
| 1092 |
--error ER_TABLESPACE_DISCARDED |
| 1093 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1094 |
|
| 1095 |
# Restore files |
| 1096 |
perl; |
| 1097 |
require 'include/innodb-util.inc'; |
| 1098 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1099 |
EOF |
| 1100 |
|
| 1101 |
SET SESSION debug="+d,ib_import_trigger_corruption_3"; |
| 1102 |
|
| 1103 |
--error ER_NOT_KEYFILE |
| 1104 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1105 |
|
| 1106 |
SET SESSION debug="-d,ib_import_trigger_corruption_3"; |
| 1107 |
|
| 1108 |
DROP TABLE test_wl5522.t1; |
| 1109 |
|
| 1110 |
perl; |
| 1111 |
require 'include/innodb-util.inc'; |
| 1112 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1113 |
EOF |
| 1114 |
|
| 1115 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1116 |
|
| 1117 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1118 |
|
| 1119 |
--error ER_TABLESPACE_DISCARDED |
| 1120 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1121 |
|
| 1122 |
SET SESSION debug="+d,ib_import_create_index_failure_1"; |
| 1123 |
|
| 1124 |
ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1); |
| 1125 |
|
| 1126 |
SET SESSION debug="-d,ib_import_create_index_failure_1"; |
| 1127 |
|
| 1128 |
DROP TABLE test_wl5522.t1; |
| 1129 |
|
| 1130 |
perl; |
| 1131 |
require 'include/innodb-util.inc'; |
| 1132 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1133 |
EOF |
| 1134 |
|
| 1135 |
# |
| 1136 |
|
| 1137 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1138 |
|
| 1139 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1140 |
|
| 1141 |
--error ER_TABLESPACE_DISCARDED |
| 1142 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1143 |
|
| 1144 |
# Restore files |
| 1145 |
perl; |
| 1146 |
require 'include/innodb-util.inc'; |
| 1147 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1148 |
EOF |
| 1149 |
|
| 1150 |
SET SESSION debug="+d,fil_space_create_failure"; |
| 1151 |
|
| 1152 |
--error ER_FILE_NOT_FOUND |
| 1153 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1154 |
|
| 1155 |
SET SESSION debug="-d,fil_space_create_failure"; |
| 1156 |
|
| 1157 |
DROP TABLE test_wl5522.t1; |
| 1158 |
|
| 1159 |
perl; |
| 1160 |
require 'include/innodb-util.inc'; |
| 1161 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1162 |
EOF |
| 1163 |
|
| 1164 |
# |
| 1165 |
|
| 1166 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1167 |
|
| 1168 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1169 |
|
| 1170 |
--error ER_TABLESPACE_DISCARDED |
| 1171 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1172 |
|
| 1173 |
# Restore files |
| 1174 |
perl; |
| 1175 |
require 'include/innodb-util.inc'; |
| 1176 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1177 |
EOF |
| 1178 |
|
| 1179 |
SET SESSION debug="+d,dict_tf_to_fsp_flags_failure"; |
| 1180 |
|
| 1181 |
--error ER_FILE_NOT_FOUND |
| 1182 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1183 |
|
| 1184 |
SET SESSION debug="-d,dict_tf_to_fsp_flags_failure"; |
| 1185 |
|
| 1186 |
DROP TABLE test_wl5522.t1; |
| 1187 |
|
| 1188 |
perl; |
| 1189 |
require 'include/innodb-util.inc'; |
| 1190 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1191 |
EOF |
| 1192 |
|
| 1193 |
# |
| 1194 |
|
| 1195 |
CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb; |
| 1196 |
|
| 1197 |
ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE; |
| 1198 |
|
| 1199 |
--error ER_TABLESPACE_DISCARDED |
| 1200 |
SELECT COUNT(*) FROM test_wl5522.t1; |
| 1201 |
|
| 1202 |
# Restore files |
| 1203 |
perl; |
| 1204 |
require 'include/innodb-util.inc'; |
| 1205 |
ib_restore_tablespaces("test_wl5522", "t1"); |
| 1206 |
EOF |
| 1207 |
|
| 1208 |
SET SESSION debug="+d,fsp_flags_is_valid_failure"; |
| 1209 |
|
| 1210 |
--replace_regex /'.*t1.cfg'/'t1.cfg'/ |
| 1211 |
|
| 1212 |
--error ER_INTERNAL_ERROR |
| 1213 |
ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE; |
| 1214 |
|
| 1215 |
SET SESSION debug="-d,fsp_flags_is_valid_failure"; |
| 1216 |
|
| 1217 |
DROP TABLE test_wl5522.t1; |
| 1218 |
|
| 1219 |
perl; |
| 1220 |
require 'include/innodb-util.inc'; |
| 1221 |
ib_unlink_tablespace("test_wl5522", "t1"); |
| 1222 |
EOF |
| 1223 |
|
| 1224 |
|
| 1225 |
DROP DATABASE test_wl5522; |
| 1226 |
|
| 1227 |
set global innodb_monitor_disable = all; |
| 1228 |
set global innodb_monitor_reset_all = all; |
| 1229 |
|
| 1230 |
--disable_query_log |
| 1231 |
call mtr.add_suppression("\\[Warning\\] .* Please refer to .*innodb-troubleshooting-datadict.html for how to resolve the issue."); |
| 1232 |
call mtr.add_suppression("\\[Warning\\] .* Ignoring tablespace `test_wl5522/t1` because it could not be opened"); |
| 1233 |
call mtr.add_suppression("\\[Warning\\] .* Tablespace for table `test_wl5522`\.`t1` is set as discarded"); |
| 1234 |
call mtr.add_suppression("\\[Warning\\] .* t1.ibd: Page .* at offset .* looks corrupted"); |
| 1235 |
call mtr.add_suppression("\\[Warning\\] .* Cannot calculate statistics for table `test_wl5522`\.`t1` because the \.ibd file is missing"); |
| 1236 |
call mtr.add_suppression("\\[Warning\\] .* Monitor ibuf_merges is already enabled"); |
| 1237 |
call mtr.add_suppression("\\[Warning\\] .* Monitor ibuf_merges_insert is already enabled"); |
| 1238 |
call mtr.add_suppression("\\[Warning\\] .* Page 0 at offset 0 looks corrupted in file"); |
| 1239 |
call mtr.add_suppression("\\[Warning\\] .* Tablespace.*, name 'test_wl5522.t1', file '.*test_wl5522.t1.ibd' is missing!"); |
| 1240 |
call mtr.add_suppression("\\[ERROR\\] .* Cannot open datafile for read-only:"); |
| 1241 |
call mtr.add_suppression("\\[ERROR\\] .* Could not find a valid tablespace file for `test_wl5522/t1`"); |
| 1242 |
call mtr.add_suppression("\\[ERROR\\] .* Failed to find tablespace for table `test_wl5522`.`t1` in the cache"); |
| 1243 |
call mtr.add_suppression("\\[ERROR\\] .* If you are installing InnoDB, remember that you must create directories yourself"); |
| 1244 |
call mtr.add_suppression("\\[ERROR\\] .* IO Error: while reading index meta-data, expected to read 44 bytes but read only 0 bytes"); |
| 1245 |
call mtr.add_suppression("\\[ERROR\\] .* Operating system error number 2 in a file operation."); |
| 1246 |
call mtr.add_suppression("\\[ERROR\\] .* The error means the system cannot find the path specified."); |
| 1247 |
call mtr.add_suppression("\\[ERROR\\] .* Trying to import a tablespace, but could not open the tablespace file"); |
| 1248 |
call mtr.add_suppression("\\[ERROR\\] .* Unsupported tablespace format"); |
| 1249 |
call mtr.add_suppression("\\[ERROR\\] .* Operating system error number 32 in a file operation."); |
| 1250 |
call mtr.add_suppression("\\[ERROR\\] .* The error means that another program is using InnoDB's files."); |
| 1251 |
--enable_query_log |
| 1252 |
|
| 1253 |
# cleanup |
| 1254 |
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg |
| 1255 |
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd |
| 1256 |
|
| 1257 |
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table; |
| 1258 |
|
| 1259 |
--source include/innodb_monitor_restore.inc |
| 1260 |
--source suite/innodb/include/check_pfs_mem_other_is_zero.inc |