| 1 |
# mysql-test-run.pl --embedded cannot restart the server. |
| 2 |
--source include/not_embedded.inc |
| 3 |
|
| 4 |
# This test case needs to crash the server. Needs a debug server. |
| 5 |
--source include/have_debug.inc |
| 6 |
|
| 7 |
# Valgrind can hang or return spurious messages on DBUG_SUICIDE |
| 8 |
--source include/not_valgrind.inc |
| 9 |
|
| 10 |
# Avoid CrashReporter popup on Mac |
| 11 |
--source include/not_crashrep.inc |
| 12 |
|
| 13 |
--source include/innodb_page_size_small.inc |
| 14 |
--source include/default_charset.inc |
| 15 |
--source include/have_sequence.inc |
| 16 |
|
| 17 |
--source include/test_db_charset_latin1.inc |
| 18 |
|
| 19 |
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded\\."); |
| 20 |
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue\\."); |
| 21 |
call mtr.add_suppression("InnoDB: Page 0 at offset 0 looks corrupted in file"); |
| 22 |
call mtr.add_suppression("InnoDB: Page for tablespace "); |
| 23 |
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=0x"); |
| 24 |
call mtr.add_suppression("InnoDB: Unknown index id .* on page"); |
| 25 |
call mtr.add_suppression("InnoDB: Operating system error number"); |
| 26 |
call mtr.add_suppression("InnoDB: Error number \\d+ means"); |
| 27 |
call mtr.add_suppression("InnoDB: Cannot open datafile .*t1\\.ibd"); |
| 28 |
call mtr.add_suppression("InnoDB: Ignoring tablespace for test/t1 "); |
| 29 |
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing"); |
| 30 |
call mtr.add_suppression("InnoDB: Failed to read page \\d+ from file '.*test/t1\\.ibd'"); |
| 31 |
call mtr.add_suppression("InnoDB: File '.*(ibdata1|t1\\.ibd)' is corrupted"); |
| 32 |
FLUSH TABLES; |
| 33 |
|
| 34 |
let MYSQLD_DATADIR =`SELECT @@datadir`; |
| 35 |
|
| 36 |
SET SESSION innodb_strict_mode=1; |
| 37 |
|
| 38 |
# Create the table that we will use for crash recovery (during IMPORT) |
| 39 |
CREATE TABLE t1 (c1 INT) ENGINE = Innodb |
| 40 |
ROW_FORMAT=COMPRESSED; |
| 41 |
INSERT INTO t1 VALUES (1), (2), (3), (4); |
| 42 |
|
| 43 |
FLUSH TABLES t1 FOR EXPORT; |
| 44 |
|
| 45 |
perl; |
| 46 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 47 |
ib_backup_tablespaces("test", "t1"); |
| 48 |
EOF |
| 49 |
UNLOCK TABLES; |
| 50 |
|
| 51 |
DROP TABLE t1; |
| 52 |
|
| 53 |
CREATE TABLE t1 (c1 INT) ENGINE = Innodb |
| 54 |
ROW_FORMAT=COMPRESSED; |
| 55 |
INSERT INTO t1 VALUES (1); |
| 56 |
|
| 57 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 58 |
|
| 59 |
perl; |
| 60 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 61 |
ib_discard_tablespaces("test", "t1"); |
| 62 |
EOF |
| 63 |
|
| 64 |
--error ER_TABLESPACE_DISCARDED |
| 65 |
SELECT COUNT(*) FROM t1; |
| 66 |
|
| 67 |
# Restore files |
| 68 |
perl; |
| 69 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 70 |
ib_restore_tablespaces("test", "t1"); |
| 71 |
EOF |
| 72 |
|
| 73 |
##### Before commit crash |
| 74 |
SET SESSION debug_dbug="+d,ib_import_before_commit_crash"; |
| 75 |
|
| 76 |
--error ER_TABLESPACE_DISCARDED |
| 77 |
SELECT * FROM t1; |
| 78 |
|
| 79 |
# Write file to make mysql-test-run.pl start up the server again |
| 80 |
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 81 |
|
| 82 |
# Execute the statement that causes the crash |
| 83 |
--error 2013 |
| 84 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 85 |
|
| 86 |
--enable_reconnect |
| 87 |
--source include/wait_until_connected_again.inc |
| 88 |
--disable_reconnect |
| 89 |
|
| 90 |
#### Before commit crash |
| 91 |
|
| 92 |
# Check that the DD is consistent after recovery |
| 93 |
|
| 94 |
##### Before checkpoint crash |
| 95 |
SET SESSION debug_dbug="+d,ib_import_before_checkpoint_crash"; |
| 96 |
|
| 97 |
--error ER_TABLESPACE_DISCARDED |
| 98 |
SELECT COUNT(*) FROM t1; |
| 99 |
|
| 100 |
# Don't start up the server right away. |
| 101 |
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 102 |
|
| 103 |
# Execute the statement that causes the crash |
| 104 |
--error 2013 |
| 105 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 106 |
|
| 107 |
# After the above test the results are non-deterministic, |
| 108 |
# delete the old tablespace files and drop the table, |
| 109 |
# recreate the table and do a proper import. |
| 110 |
-- source include/wait_until_disconnected.inc |
| 111 |
perl; |
| 112 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 113 |
ib_unlink_tablespace("test", "t1"); |
| 114 |
EOF |
| 115 |
|
| 116 |
--echo # Restart and reconnect to the server |
| 117 |
--enable_reconnect |
| 118 |
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 119 |
--source include/wait_until_connected_again.inc |
| 120 |
--disable_reconnect |
| 121 |
|
| 122 |
#### Before checkpoint crash |
| 123 |
|
| 124 |
# After the above test the results are non-deterministic, recreate the table |
| 125 |
# and do a proper import. |
| 126 |
|
| 127 |
DROP TABLE t1; |
| 128 |
|
| 129 |
SET SESSION innodb_strict_mode=1; |
| 130 |
|
| 131 |
CREATE TABLE t1 (c1 INT) ENGINE = Innodb |
| 132 |
ROW_FORMAT=COMPRESSED; |
| 133 |
|
| 134 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 135 |
|
| 136 |
perl; |
| 137 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 138 |
ib_restore_tablespaces("test", "t1"); |
| 139 |
EOF |
| 140 |
|
| 141 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 142 |
CHECK TABLE t1; |
| 143 |
|
| 144 |
SELECT COUNT(*) FROM t1; |
| 145 |
|
| 146 |
INSERT INTO t1 VALUES(400), (500), (600); |
| 147 |
|
| 148 |
SELECT * FROM t1; |
| 149 |
|
| 150 |
DROP TABLE t1; |
| 151 |
|
| 152 |
# Test handling of internal failure error |
| 153 |
CREATE TABLE t1 (c1 INT) ENGINE = Innodb |
| 154 |
ROW_FORMAT=COMPRESSED; |
| 155 |
|
| 156 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 157 |
|
| 158 |
--error ER_TABLESPACE_DISCARDED |
| 159 |
SELECT COUNT(*) FROM t1; |
| 160 |
|
| 161 |
# Restore files |
| 162 |
perl; |
| 163 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 164 |
ib_restore_tablespaces("test", "t1"); |
| 165 |
EOF |
| 166 |
|
| 167 |
# Test failure after reset of space id and LSN in the tablespace |
| 168 |
SET @saved_debug_dbug = @@SESSION.debug_dbug; |
| 169 |
SET SESSION debug_dbug="+d,ib_import_internal_error"; |
| 170 |
|
| 171 |
--error ER_INTERNAL_ERROR |
| 172 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 173 |
|
| 174 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 175 |
|
| 176 |
# Restore files |
| 177 |
perl; |
| 178 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 179 |
ib_restore_tablespaces("test", "t1"); |
| 180 |
EOF |
| 181 |
|
| 182 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 183 |
|
| 184 |
DROP TABLE t1; |
| 185 |
|
| 186 |
|
| 187 |
# Test failure after reset of space id and LSN in the tablespace |
| 188 |
CREATE TABLE t1 (c1 INT) ENGINE = Innodb |
| 189 |
ROW_FORMAT=COMPRESSED; |
| 190 |
|
| 191 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 192 |
|
| 193 |
--error ER_TABLESPACE_DISCARDED |
| 194 |
SELECT COUNT(*) FROM t1; |
| 195 |
|
| 196 |
# Restore files |
| 197 |
perl; |
| 198 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 199 |
ib_restore_tablespaces("test", "t1"); |
| 200 |
EOF |
| 201 |
|
| 202 |
# Test failure after reset of space id and LSN in the tablespace |
| 203 |
SET SESSION debug_dbug="+d,ib_import_reset_space_and_lsn_failure"; |
| 204 |
|
| 205 |
--error ER_INTERNAL_ERROR |
| 206 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 207 |
|
| 208 |
# Restore files |
| 209 |
perl; |
| 210 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 211 |
ib_restore_tablespaces("test", "t1"); |
| 212 |
EOF |
| 213 |
|
| 214 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 215 |
|
| 216 |
# Test failure after attempting a tablespace open |
| 217 |
SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; |
| 218 |
|
| 219 |
--replace_result \\ / |
| 220 |
--error ER_GET_ERRMSG |
| 221 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 222 |
|
| 223 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 224 |
|
| 225 |
# Restore files |
| 226 |
perl; |
| 227 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 228 |
ib_restore_tablespaces("test", "t1"); |
| 229 |
EOF |
| 230 |
|
| 231 |
# Test failure after adjusting the cluster index root page |
| 232 |
SET SESSION debug_dbug="+d,ib_import_cluster_root_adjust_failure"; |
| 233 |
|
| 234 |
--error ER_NOT_KEYFILE |
| 235 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 236 |
|
| 237 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 238 |
|
| 239 |
# Restore files |
| 240 |
perl; |
| 241 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 242 |
ib_restore_tablespaces("test", "t1"); |
| 243 |
EOF |
| 244 |
|
| 245 |
# Test failure after importing the cluster index |
| 246 |
SET SESSION debug_dbug="+d,ib_import_cluster_failure"; |
| 247 |
|
| 248 |
--error ER_NOT_KEYFILE |
| 249 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 250 |
|
| 251 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 252 |
|
| 253 |
# Restore files |
| 254 |
perl; |
| 255 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 256 |
ib_restore_tablespaces("test", "t1"); |
| 257 |
EOF |
| 258 |
|
| 259 |
# Test failure after importing the secondary index(es) |
| 260 |
SET SESSION debug_dbug="+d,ib_import_sec_root_adjust_failure"; |
| 261 |
|
| 262 |
--error ER_NOT_KEYFILE |
| 263 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 264 |
|
| 265 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 266 |
|
| 267 |
# Restore files |
| 268 |
perl; |
| 269 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 270 |
ib_restore_tablespaces("test", "t1"); |
| 271 |
EOF |
| 272 |
|
| 273 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 274 |
DROP TABLE t1; |
| 275 |
|
| 276 |
# |
| 277 |
# Create a large table with delete marked records, disable purge during |
| 278 |
# the update so that we can test the IMPORT purge code. |
| 279 |
# |
| 280 |
CREATE TABLE t1 ( |
| 281 |
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
| 282 |
c2 BIGINT, |
| 283 |
c3 VARCHAR(2048), |
| 284 |
c4 VARCHAR(2048), |
| 285 |
INDEX idx1(c2), |
| 286 |
INDEX idx2(c3(512)), |
| 287 |
INDEX idx3(c4(512))) Engine=InnoDB |
| 288 |
ROW_FORMAT=COMPRESSED; |
| 289 |
|
| 290 |
# Stop purge so that it doesn't remove the delete marked entries. |
| 291 |
connect (purge_control,localhost,root); |
| 292 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 293 |
connection default; |
| 294 |
|
| 295 |
INSERT INTO t1 |
| 296 |
SELECT 1 + seq, 1 + (seq MOD 4), |
| 297 |
REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048), |
| 298 |
REPEAT(SUBSTR('abcd', 1 + (seq MOD 4), 1), 2048) |
| 299 |
FROM seq_0_to_127; |
| 300 |
|
| 301 |
DELETE FROM t1 WHERE c2 = 1; |
| 302 |
|
| 303 |
UPDATE t1 SET c2 = c2 + c1; |
| 304 |
UPDATE t1 SET c2 = c2 + c1; |
| 305 |
UPDATE t1 SET c2 = c2 + c1; |
| 306 |
UPDATE t1 SET c2 = c2 + c1; |
| 307 |
UPDATE t1 SET c2 = c2 + c1; |
| 308 |
UPDATE t1 SET c2 = c2 + c1; |
| 309 |
UPDATE t1 SET c2 = c2 + c1; |
| 310 |
UPDATE t1 SET c2 = c2 + c1; |
| 311 |
UPDATE t1 SET c2 = c2 + c1; |
| 312 |
UPDATE t1 SET c2 = c2 + c1; |
| 313 |
UPDATE t1 SET c2 = c2 + c1; |
| 314 |
UPDATE t1 SET c2 = c2 + c1; |
| 315 |
UPDATE t1 SET c2 = c2 + c1; |
| 316 |
UPDATE t1 SET c2 = c2 + c1; |
| 317 |
UPDATE t1 SET c2 = c2 + c1; |
| 318 |
UPDATE t1 SET c3 = REPEAT("c2", 1024); |
| 319 |
UPDATE t1 SET c4 = REPEAT("c4", 1024); |
| 320 |
|
| 321 |
SHOW CREATE TABLE t1; |
| 322 |
|
| 323 |
FLUSH TABLES t1 FOR EXPORT; |
| 324 |
|
| 325 |
perl; |
| 326 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 327 |
ib_backup_tablespaces("test", "t1"); |
| 328 |
EOF |
| 329 |
|
| 330 |
UNLOCK TABLES; |
| 331 |
|
| 332 |
# Enable normal operation |
| 333 |
connection purge_control; |
| 334 |
COMMIT; |
| 335 |
disconnect purge_control; |
| 336 |
connection default; |
| 337 |
|
| 338 |
DROP TABLE t1; |
| 339 |
|
| 340 |
CREATE TABLE t1 ( |
| 341 |
c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
| 342 |
c2 BIGINT, |
| 343 |
c3 VARCHAR(2048), |
| 344 |
c4 VARCHAR(2048), |
| 345 |
INDEX idx1(c2), |
| 346 |
INDEX idx2(c3(512)), |
| 347 |
INDEX idx3(c4(512))) Engine=InnoDB |
| 348 |
ROW_FORMAT=COMPRESSED; |
| 349 |
|
| 350 |
SELECT c1, c2 FROM t1; |
| 351 |
|
| 352 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 353 |
|
| 354 |
perl; |
| 355 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 356 |
ib_restore_tablespaces("test", "t1"); |
| 357 |
EOF |
| 358 |
|
| 359 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 360 |
CHECK TABLE t1; |
| 361 |
|
| 362 |
SELECT c1,c2 FROM t1; |
| 363 |
|
| 364 |
SHOW CREATE TABLE t1; |
| 365 |
|
| 366 |
DROP TABLE t1; |
| 367 |
|
| 368 |
#### |
| 369 |
# Create a table and save the tablespace and .cfg file, we need to create |
| 370 |
# a Btree that has several levels |
| 371 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 372 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 373 |
|
| 374 |
INSERT INTO t1 |
| 375 |
SELECT 100, REPEAT('Karanbir', 128), REPEAT('Ajeeth', 1200) |
| 376 |
FROM seq_1_to_256; |
| 377 |
FLUSH TABLES t1 FOR EXPORT; |
| 378 |
|
| 379 |
perl; |
| 380 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 381 |
ib_backup_tablespaces("test", "t1"); |
| 382 |
EOF |
| 383 |
|
| 384 |
UNLOCK TABLES; |
| 385 |
|
| 386 |
DROP TABLE t1; |
| 387 |
|
| 388 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 389 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 390 |
|
| 391 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 392 |
|
| 393 |
--error ER_TABLESPACE_DISCARDED |
| 394 |
SELECT COUNT(*) FROM t1; |
| 395 |
|
| 396 |
# Restore files |
| 397 |
perl; |
| 398 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 399 |
ib_restore_tablespaces("test", "t1"); |
| 400 |
EOF |
| 401 |
|
| 402 |
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_1"; |
| 403 |
|
| 404 |
--error ER_INTERNAL_ERROR |
| 405 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 406 |
|
| 407 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 408 |
|
| 409 |
DROP TABLE t1; |
| 410 |
|
| 411 |
perl; |
| 412 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 413 |
ib_unlink_tablespace("test", "t1"); |
| 414 |
EOF |
| 415 |
|
| 416 |
# |
| 417 |
|
| 418 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 419 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 420 |
|
| 421 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 422 |
|
| 423 |
--error ER_TABLESPACE_DISCARDED |
| 424 |
SELECT COUNT(*) FROM t1; |
| 425 |
|
| 426 |
# Restore files |
| 427 |
let INNODB_PAGE_SIZE=`select @@innodb_page_size`; |
| 428 |
let MYSQLD_DATADIR=`select @@datadir`; |
| 429 |
|
| 430 |
perl; |
| 431 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 432 |
ib_restore_tablespaces("test", "t1"); |
| 433 |
my $page; |
| 434 |
my $ps = $ENV{INNODB_PAGE_SIZE}; |
| 435 |
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd"; |
| 436 |
open(FILE, "+<$file") || die "Unable to open $file"; |
| 437 |
binmode FILE; |
| 438 |
sysseek(FILE, 4*$ps, 0) || die "Unable to seek $file\n"; |
| 439 |
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps; |
| 440 |
substr($page,24,2)='42'; |
| 441 |
sysseek(FILE, 4*$ps, 0) || die "Unable to rewind $file\n"; |
| 442 |
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n"; |
| 443 |
close(FILE) || die "Unable to close $file"; |
| 444 |
EOF |
| 445 |
|
| 446 |
# Following alter is failing |
| 447 |
--error ER_INTERNAL_ERROR,ER_NOT_KEYFILE |
| 448 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 449 |
|
| 450 |
DROP TABLE t1; |
| 451 |
|
| 452 |
perl; |
| 453 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 454 |
ib_unlink_tablespace("test", "t1"); |
| 455 |
EOF |
| 456 |
|
| 457 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 458 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 459 |
|
| 460 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 461 |
|
| 462 |
--error ER_TABLESPACE_DISCARDED |
| 463 |
SELECT COUNT(*) FROM t1; |
| 464 |
|
| 465 |
# Restore files |
| 466 |
perl; |
| 467 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 468 |
ib_restore_tablespaces("test", "t1"); |
| 469 |
EOF |
| 470 |
|
| 471 |
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_2"; |
| 472 |
|
| 473 |
--error ER_INNODB_INDEX_CORRUPT |
| 474 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 475 |
|
| 476 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 477 |
|
| 478 |
DROP TABLE t1; |
| 479 |
|
| 480 |
perl; |
| 481 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 482 |
ib_unlink_tablespace("test", "t1"); |
| 483 |
EOF |
| 484 |
|
| 485 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 486 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 487 |
|
| 488 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 489 |
|
| 490 |
--error ER_TABLESPACE_DISCARDED |
| 491 |
SELECT COUNT(*) FROM t1; |
| 492 |
|
| 493 |
# Restore files |
| 494 |
perl; |
| 495 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 496 |
ib_restore_tablespaces("test", "t1"); |
| 497 |
EOF |
| 498 |
|
| 499 |
SET SESSION debug_dbug="+d,ib_import_trigger_corruption_3"; |
| 500 |
|
| 501 |
--error ER_NOT_KEYFILE |
| 502 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 503 |
|
| 504 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 505 |
|
| 506 |
DROP TABLE t1; |
| 507 |
|
| 508 |
perl; |
| 509 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 510 |
ib_unlink_tablespace("test", "t1"); |
| 511 |
EOF |
| 512 |
|
| 513 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 514 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 515 |
|
| 516 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 517 |
|
| 518 |
--error ER_TABLESPACE_DISCARDED |
| 519 |
SELECT COUNT(*) FROM t1; |
| 520 |
|
| 521 |
SET SESSION debug_dbug="+d,ib_import_create_index_failure_1"; |
| 522 |
|
| 523 |
ALTER TABLE t1 ADD INDEX idx(c1); |
| 524 |
|
| 525 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 526 |
|
| 527 |
DROP TABLE t1; |
| 528 |
|
| 529 |
perl; |
| 530 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 531 |
ib_unlink_tablespace("test", "t1"); |
| 532 |
EOF |
| 533 |
|
| 534 |
# |
| 535 |
|
| 536 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 537 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 538 |
|
| 539 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 540 |
|
| 541 |
--error ER_TABLESPACE_DISCARDED |
| 542 |
SELECT COUNT(*) FROM t1; |
| 543 |
|
| 544 |
# Restore files |
| 545 |
perl; |
| 546 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 547 |
ib_restore_tablespaces("test", "t1"); |
| 548 |
EOF |
| 549 |
|
| 550 |
SET SESSION debug_dbug="+d,fil_space_create_failure"; |
| 551 |
|
| 552 |
--replace_result \\ / |
| 553 |
--error ER_GET_ERRMSG |
| 554 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 555 |
|
| 556 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 557 |
|
| 558 |
DROP TABLE t1; |
| 559 |
|
| 560 |
perl; |
| 561 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 562 |
ib_unlink_tablespace("test", "t1"); |
| 563 |
EOF |
| 564 |
|
| 565 |
# |
| 566 |
|
| 567 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 568 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 569 |
|
| 570 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 571 |
|
| 572 |
--error ER_TABLESPACE_DISCARDED |
| 573 |
SELECT COUNT(*) FROM t1; |
| 574 |
|
| 575 |
# Restore files |
| 576 |
perl; |
| 577 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 578 |
ib_restore_tablespaces("test", "t1"); |
| 579 |
EOF |
| 580 |
|
| 581 |
SET SESSION debug_dbug="+d,dict_tf_to_fsp_flags_failure"; |
| 582 |
|
| 583 |
--replace_result \\ / |
| 584 |
--error ER_GET_ERRMSG |
| 585 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 586 |
|
| 587 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 588 |
|
| 589 |
DROP TABLE t1; |
| 590 |
|
| 591 |
perl; |
| 592 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 593 |
ib_unlink_tablespace("test", "t1"); |
| 594 |
EOF |
| 595 |
|
| 596 |
# |
| 597 |
|
| 598 |
CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb |
| 599 |
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; |
| 600 |
|
| 601 |
ALTER TABLE t1 DISCARD TABLESPACE; |
| 602 |
|
| 603 |
--error ER_TABLESPACE_DISCARDED |
| 604 |
SELECT COUNT(*) FROM t1; |
| 605 |
|
| 606 |
# Restore files |
| 607 |
perl; |
| 608 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 609 |
ib_restore_tablespaces("test", "t1"); |
| 610 |
EOF |
| 611 |
|
| 612 |
SET SESSION debug_dbug="+d,fsp_flags_is_valid_failure"; |
| 613 |
|
| 614 |
--error ER_NOT_KEYFILE |
| 615 |
ALTER TABLE t1 IMPORT TABLESPACE; |
| 616 |
|
| 617 |
SET SESSION debug_dbug=@saved_debug_dbug; |
| 618 |
|
| 619 |
DROP TABLE t1; |
| 620 |
|
| 621 |
perl; |
| 622 |
do "$ENV{MTR_SUITE_DIR}/../innodb/include/innodb-util.pl"; |
| 623 |
ib_unlink_tablespace("test", "t1"); |
| 624 |
EOF |
| 625 |
|
| 626 |
--disable_query_log |
| 627 |
call mtr.add_suppression("'Resource temporarily unavailable'"); |
| 628 |
call mtr.add_suppression("Got error -1 when reading table '.*'"); |
| 629 |
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded."); |
| 630 |
call mtr.add_suppression("InnoDB: Tablespace '.*' exists in the cache"); |
| 631 |
call mtr.add_suppression("InnoDB: Freeing existing tablespace '.*' entry from the cache with id.*"); |
| 632 |
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded"); |
| 633 |
call mtr.add_suppression("There was an error writing to the meta data file"); |
| 634 |
call mtr.add_suppression("InnoDB: Trying to import a tablespace, but could not open the tablespace file"); |
| 635 |
call mtr.add_suppression("Unsupported tablespace format"); |
| 636 |
call mtr.add_suppression("Page is marked as free"); |
| 637 |
call mtr.add_suppression("t1.ibd: Page .* at offset .* looks corrupted"); |
| 638 |
call mtr.add_suppression("but tablespace with that id or name does not exist"); |
| 639 |
call mtr.add_suppression("Could not find a valid tablespace file for '.*t1'"); |
| 640 |
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it"); |
| 641 |
--enable_query_log |
| 642 |
|
| 643 |
#cleanup |
| 644 |
--remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg |
| 645 |
--remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd |
| 646 |
|
| 647 |
--source include/test_db_charset_restore.inc |