Debian Codegraph @

mysql-test/suite/innodb_zip/t/transportable_tbsp_debug_zip.test

raw
1 # This test case needs to crash the server. Needs a debug server.
2 --source include/have_debug.inc
3
4 # Valgrind can hang or return spurious messages on DBUG_SUICIDE
5 --source include/not_valgrind.inc
6
7 # Avoid CrashReporter popup on Mac
8 --source include/not_crashrep.inc
9
10 -- source include/have_innodb_max_16k.inc
11
12 # compressed table in tests are with sizes KEY_BLOCK_SIZE 1,2,4,8,16
13 # Table creatation fails if KEY_BLOCK_SIZE > innodb-page-size,so
14 # allow test to run only when innodb-page-size=16
15
16 let MYSQLD_DATADIR =`SELECT @@datadir`;
17 let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
18 let $innodb_strict_mode_orig=`select @@session.innodb_strict_mode`;
19
20 SET GLOBAL innodb_file_per_table = 1;
21 SELECT @@innodb_file_per_table;
22
23 SET SESSION innodb_strict_mode=1;
24 SELECT @@SESSION.innodb_strict_mode;
25
26
27
28 DROP DATABASE IF EXISTS test_wl5522;
29 CREATE DATABASE test_wl5522;
30
31 # Create the table that we will use for crash recovery (during IMPORT)
32 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
33 ROW_FORMAT=COMPRESSED;
34 INSERT INTO test_wl5522.t1 VALUES (1), (2), (3), (4);
35
36 --replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
37
38 FLUSH TABLES test_wl5522.t1 FOR EXPORT;
39
40 perl;
41 require 'include/innodb-util.inc';
42 ib_backup_tablespaces("test_wl5522", "t1");
43 EOF
44 UNLOCK TABLES;
45
46 DROP TABLE test_wl5522.t1;
47
48 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
49 ROW_FORMAT=COMPRESSED;
50 INSERT INTO test_wl5522.t1 VALUES (1);
51
52 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
53
54 perl;
55 require 'include/innodb-util.inc';
56 ib_discard_tablespaces("test_wl5522", "t1");
57 EOF
58
59 --error ER_TABLESPACE_DISCARDED
60 SELECT COUNT(*) FROM test_wl5522.t1;
61
62 # Restore files
63 perl;
64 require 'include/innodb-util.inc';
65 ib_restore_tablespaces("test_wl5522", "t1");
66 EOF
67
68 ##### Before commit crash
69 SET SESSION debug="+d,ib_import_before_commit_crash";
70
71 --error ER_TABLESPACE_DISCARDED
72 SELECT * FROM test_wl5522.t1;
73
74 # Write file to make mysql-test-run.pl start up the server again
75 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
76
77 # Execute the statement that causes the crash
78 --error 2013
79 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
80
81 perl;
82 require 'include/innodb-util.inc';
83 ib_unlink_tablespace("test_wl5522", "t1");
84 EOF
85
86 --enable_reconnect
87 --source include/wait_until_connected_again.inc
88 --disable_reconnect
89
90 #### After commit crash
91
92 # Check that the DD is consistent after recovery
93
94 ##### Before checkpoint crash
95 SET SESSION debug="+d,ib_import_before_checkpoint_crash";
96
97 --error ER_TABLESPACE_DISCARDED
98 SELECT COUNT(*) FROM test_wl5522.t1;
99
100 # Don't start up the server right away.
101 --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
102
103 # Execute the statement that causes the crash
104 --error 2013
105 ALTER TABLE test_wl5522.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 require 'include/innodb-util.inc';
113 ib_unlink_tablespace("test_wl5522", "t1");
114 EOF
115
116 --echo # Restart and reconnect to the server
117 --enable_reconnect
118 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
119 --source include/wait_until_connected_again.inc
120 --disable_reconnect
121
122 #### After 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 test_wl5522.t1;
128
129 SET GLOBAL innodb_file_per_table = 1;
130 SELECT @@innodb_file_per_table;
131
132 SET SESSION innodb_strict_mode=1;
133 SELECT @@SESSION.innodb_strict_mode;
134
135 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
136 ROW_FORMAT=COMPRESSED;
137
138 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
139
140 perl;
141 require 'include/innodb-util.inc';
142 ib_restore_tablespaces("test_wl5522", "t1");
143 EOF
144
145 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
146 CHECK TABLE test_wl5522.t1;
147
148 SELECT COUNT(*) FROM test_wl5522.t1;
149
150 INSERT INTO test_wl5522.t1 VALUES(400), (500), (600);
151
152 SELECT * FROM test_wl5522.t1;
153
154 DROP TABLE test_wl5522.t1;
155
156 # Test handling of internal failure error
157 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
158 ROW_FORMAT=COMPRESSED;
159
160 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
161
162 --error ER_TABLESPACE_DISCARDED
163 SELECT COUNT(*) FROM test_wl5522.t1;
164
165 # Restore files
166 perl;
167 require 'include/innodb-util.inc';
168 ib_restore_tablespaces("test_wl5522", "t1");
169 EOF
170
171 # Test failure after reset of space id and LSN in the tablespace
172 SET SESSION debug="+d,ib_import_internal_error";
173
174 --replace_regex /'.*t1.cfg'/'t1.cfg'/
175
176 --error ER_INTERNAL_ERROR
177 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
178
179 SET SESSION debug="-d,ib_import_internal_error";
180
181 # Restore files
182 perl;
183 require 'include/innodb-util.inc';
184 ib_restore_tablespaces("test_wl5522", "t1");
185 EOF
186
187 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
188
189 DROP TABLE test_wl5522.t1;
190
191
192 # Test failure after reset of space id and LSN in the tablespace
193 CREATE TABLE test_wl5522.t1 (c1 INT) ENGINE = Innodb
194 ROW_FORMAT=COMPRESSED;
195
196 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
197
198 --error ER_TABLESPACE_DISCARDED
199 SELECT COUNT(*) FROM test_wl5522.t1;
200
201 # Restore files
202 perl;
203 require 'include/innodb-util.inc';
204 ib_restore_tablespaces("test_wl5522", "t1");
205 EOF
206
207 # Test failure after reset of space id and LSN in the tablespace
208 SET SESSION debug="+d,ib_import_reset_space_and_lsn_failure";
209
210 --replace_regex /'.*t1.cfg'/'t1.cfg'/
211
212 --error ER_INTERNAL_ERROR
213 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
214
215 # Restore files
216 perl;
217 require 'include/innodb-util.inc';
218 ib_restore_tablespaces("test_wl5522", "t1");
219 EOF
220
221 SET SESSION debug="-d,ib_import_reset_space_and_lsn_failure";
222
223 # Test failure after attempting a tablespace open
224 SET SESSION debug="+d,ib_import_open_tablespace_failure";
225
226 --replace_regex /file: '.*t1.ibd'/'t1.ibd'/
227
228 --error ER_FILE_NOT_FOUND
229 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
230
231 SET SESSION debug="-d,ib_import_open_tablespace_failure";
232
233 # Restore files
234 perl;
235 require 'include/innodb-util.inc';
236 ib_restore_tablespaces("test_wl5522", "t1");
237 EOF
238
239 # Test failure after ibuf check
240 SET SESSION debug="+d,ib_import_check_bitmap_failure";
241
242 # Need proper mapping of error codes :-(
243 --error ER_NOT_KEYFILE
244 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
245
246 SET SESSION debug="-d,ib_import_check_bitmap_failure";
247
248 # Restore files
249 perl;
250 require 'include/innodb-util.inc';
251 ib_restore_tablespaces("test_wl5522", "t1");
252 EOF
253
254 # Test failure after adjusting the cluster index root page
255 SET SESSION debug="+d,ib_import_cluster_root_adjust_failure";
256
257 --error ER_NOT_KEYFILE
258 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
259
260 SET SESSION debug="-d,ib_import_cluster_root_adjust_failure";
261
262 # Restore files
263 perl;
264 require 'include/innodb-util.inc';
265 ib_restore_tablespaces("test_wl5522", "t1");
266 EOF
267
268 # Test failure after importing the cluster index
269 SET SESSION debug="+d,ib_import_cluster_failure";
270
271 --error ER_NOT_KEYFILE
272 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
273
274 SET SESSION debug="-d,ib_import_cluster_failure";
275
276 # Restore files
277 perl;
278 require 'include/innodb-util.inc';
279 ib_restore_tablespaces("test_wl5522", "t1");
280 EOF
281
282 # Test failure after importing the secondary index(es)
283 SET SESSION debug="+d,ib_import_sec_root_adjust_failure";
284
285 --error ER_NOT_KEYFILE
286 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
287
288 SET SESSION debug="-d,ib_import_sec_root_adjust_failure";
289
290 # Restore files
291 perl;
292 require 'include/innodb-util.inc';
293 ib_restore_tablespaces("test_wl5522", "t1");
294 EOF
295
296 # Test failure after importing the cluster index
297 SET SESSION debug="+d,ib_import_set_max_rowid_failure";
298
299 --error ER_NOT_KEYFILE
300 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
301
302 SET SESSION debug="-d,ib_import_set_max_rowid_failure";
303
304 # Left over from the failed IMPORT
305 perl;
306 require 'include/innodb-util.inc';
307 ib_unlink_tablespace("test_wl5522", "t1");
308 EOF
309
310 DROP TABLE test_wl5522.t1;
311
312 --disable_query_log
313 # Enable metrics for the counters we are going to use
314 set global innodb_monitor_enable = purge_stop_count;
315 set global innodb_monitor_enable = purge_resume_count;
316 set global innodb_monitor_enable = ibuf_merges;
317 set global innodb_monitor_enable = ibuf_merges_insert;
318 --enable_query_log
319
320 #
321 # Create a large table with delete marked records, disable purge during
322 # the update so that we can test the IMPORT purge code.
323 #
324 CREATE TABLE test_wl5522.t1 (
325 c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
326 c2 BIGINT,
327 c3 VARCHAR(2048),
328 c4 VARCHAR(2048),
329 INDEX idx1(c2),
330 INDEX idx2(c3(512)),
331 INDEX idx3(c4(512))) Engine=InnoDB
332 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
333
334 # Stop purge so that it doesn't remove the delete marked entries.
335 SET GLOBAL INNODB_PURGE_STOP_NOW=ON;
336
337 # Disable change buffer merge from the master thread, additionally
338 # enable aggressive flushing so that more changes are buffered.
339 SET GLOBAL innodb_disable_background_merge=ON;
340 SET GLOBAL innodb_monitor_reset = ibuf_merges;
341 SET GLOBAL innodb_monitor_reset = ibuf_merges_insert;
342
343 INSERT INTO test_wl5522.t1(c2, c3, c4) VALUES
344 (1, REPEAT('a', 2048), REPEAT('a', 2048)),
345 (2, REPEAT('b', 2048), REPEAT('b', 2048)),
346 (3, REPEAT('c', 2048), REPEAT('c', 2048)),
347 (4, REPEAT('d', 2048), REPEAT('d', 2048));
348
349 INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
350 INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
351 INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
352 INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
353 INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
354
355 DELETE FROM test_wl5522.t1 WHERE c2 = 1;
356
357 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
358 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
359 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
360 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
361 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
362 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
363 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
364 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
365 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
366 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
367 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
368 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
369 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
370 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
371 UPDATE test_wl5522.t1 SET c2 = c2 + c1;
372 UPDATE test_wl5522.t1 SET c3 = REPEAT("c2", 1024);
373 UPDATE test_wl5522.t1 SET c4 = REPEAT("c4", 1024);
374
375 SHOW CREATE TABLE test_wl5522.t1;
376
377 SELECT c1, c2 FROM test_wl5522.t1;
378 SELECT COUNT(*) FROM test_wl5522.t1;
379 SELECT SUM(c2) FROM test_wl5522.t1;
380
381 SELECT name
382 FROM information_schema.innodb_metrics
383 WHERE name = 'ibuf_merges_insert' AND count = 0;
384
385 FLUSH TABLES test_wl5522.t1 FOR EXPORT;
386
387 perl;
388 require 'include/innodb-util.inc';
389 ib_backup_tablespaces("test_wl5522", "t1");
390 EOF
391
392 UNLOCK TABLES;
393
394 SELECT name
395 FROM information_schema.innodb_metrics
396 WHERE name = 'ibuf_merges' AND count > 0;
397
398 SELECT name
399 FROM information_schema.innodb_metrics
400 WHERE name = 'ibuf_merges_inserts' AND count > 0;
401
402 SET GLOBAL innodb_disable_background_merge=OFF;
403
404 # Enable normal operation
405 SET GLOBAL INNODB_PURGE_RUN_NOW=ON;
406
407 DROP TABLE test_wl5522.t1;
408
409 CREATE TABLE test_wl5522.t1 (
410 c1 BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
411 c2 BIGINT,
412 c3 VARCHAR(2048),
413 c4 VARCHAR(2048),
414 INDEX idx1(c2),
415 INDEX idx2(c3(512)),
416 INDEX idx3(c4(512))) Engine=InnoDB
417 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
418
419 SELECT c1, c2 FROM test_wl5522.t1;
420
421 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
422
423 perl;
424 require 'include/innodb-util.inc';
425 ib_restore_tablespaces("test_wl5522", "t1");
426 EOF
427
428 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
429 CHECK TABLE test_wl5522.t1;
430
431 SELECT c1,c2 FROM test_wl5522.t1;
432 SELECT COUNT(*) FROM test_wl5522.t1;
433 SELECT SUM(c2) FROM test_wl5522.t1;
434
435 SHOW CREATE TABLE test_wl5522.t1;
436
437 DROP TABLE test_wl5522.t1;
438
439 ####
440 # Create a table and save the tablespace and .cfg file, we need to create
441 # a Btree that has several levels
442 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
443 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
444
445 INSERT IGNORE INTO test_wl5522.t1 VALUES
446 (100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 1200));
447
448 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
449 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
450 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
451 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
452 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
453 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
454 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
455 INSERT INTO test_wl5522.t1 SELECT * FROM test_wl5522.t1;
456 SELECT COUNT(*) FROM test_wl5522.t1;
457 FLUSH TABLES test_wl5522.t1 FOR EXPORT;
458
459 perl;
460 require 'include/innodb-util.inc';
461 ib_backup_tablespaces("test_wl5522", "t1");
462 EOF
463
464 UNLOCK TABLES;
465
466 DROP TABLE test_wl5522.t1;
467
468 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
469 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
470
471 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
472
473 --error ER_TABLESPACE_DISCARDED
474 SELECT COUNT(*) FROM test_wl5522.t1;
475
476 # Restore files
477 perl;
478 require 'include/innodb-util.inc';
479 ib_restore_tablespaces("test_wl5522", "t1");
480 EOF
481
482 SET SESSION debug="+d,ib_import_trigger_corruption_1";
483
484 --replace_regex /'.*t1.cfg'/'t1.cfg'/
485
486 --error ER_INTERNAL_ERROR
487 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
488
489 SET SESSION debug="-d,ib_import_trigger_corruption_1";
490
491 DROP TABLE test_wl5522.t1;
492
493 perl;
494 require 'include/innodb-util.inc';
495 ib_unlink_tablespace("test_wl5522", "t1");
496 EOF
497
498 #
499
500 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
501 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
502
503 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
504
505 --error ER_TABLESPACE_DISCARDED
506 SELECT COUNT(*) FROM test_wl5522.t1;
507
508 # Restore files
509 perl;
510 require 'include/innodb-util.inc';
511 ib_restore_tablespaces("test_wl5522", "t1");
512 EOF
513
514 SET SESSION debug="+d,buf_page_import_corrupt_failure";
515
516 --replace_regex /'.*t1.cfg'/'t1.cfg'/
517
518 # Following alter is not failing
519 #--error ER_INTERNAL_ERROR
520 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
521
522 SET SESSION debug="-d,buf_page_import_corrupt_failure";
523
524 DROP TABLE test_wl5522.t1;
525
526 perl;
527 require 'include/innodb-util.inc';
528 ib_unlink_tablespace("test_wl5522", "t1");
529 EOF
530
531 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
532 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
533
534 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
535
536 --error ER_TABLESPACE_DISCARDED
537 SELECT COUNT(*) FROM test_wl5522.t1;
538
539 # Restore files
540 perl;
541 require 'include/innodb-util.inc';
542 ib_restore_tablespaces("test_wl5522", "t1");
543 EOF
544
545 SET SESSION debug="+d,ib_import_trigger_corruption_2";
546
547 --error ER_INNODB_INDEX_CORRUPT
548 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
549
550 SET SESSION debug="-d,ib_import_trigger_corruption_2";
551
552 DROP TABLE test_wl5522.t1;
553
554 perl;
555 require 'include/innodb-util.inc';
556 ib_unlink_tablespace("test_wl5522", "t1");
557 EOF
558
559 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
560 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
561
562 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
563
564 --error ER_TABLESPACE_DISCARDED
565 SELECT COUNT(*) FROM test_wl5522.t1;
566
567 # Restore files
568 perl;
569 require 'include/innodb-util.inc';
570 ib_restore_tablespaces("test_wl5522", "t1");
571 EOF
572
573 SET SESSION debug="+d,ib_import_trigger_corruption_3";
574
575 --replace_regex /'.*t1.cfg'/'t1.cfg'/
576
577 --error ER_NOT_KEYFILE
578 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
579
580 SET SESSION debug="-d,ib_import_trigger_corruption_3";
581
582 DROP TABLE test_wl5522.t1;
583
584 perl;
585 require 'include/innodb-util.inc';
586 ib_unlink_tablespace("test_wl5522", "t1");
587 EOF
588
589 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
590 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
591
592 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
593
594 --error ER_TABLESPACE_DISCARDED
595 SELECT COUNT(*) FROM test_wl5522.t1;
596
597 SET SESSION debug="+d,ib_import_create_index_failure_1";
598
599 ALTER TABLE test_wl5522.t1 ADD INDEX idx(c1);
600
601 SET SESSION debug="-d,ib_import_create_index_failure_1";
602
603 DROP TABLE test_wl5522.t1;
604
605 perl;
606 require 'include/innodb-util.inc';
607 ib_unlink_tablespace("test_wl5522", "t1");
608 EOF
609
610 #
611
612 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
613 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
614
615 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
616
617 --error ER_TABLESPACE_DISCARDED
618 SELECT COUNT(*) FROM test_wl5522.t1;
619
620 # Restore files
621 perl;
622 require 'include/innodb-util.inc';
623 ib_restore_tablespaces("test_wl5522", "t1");
624 EOF
625
626 SET SESSION debug="+d,fil_space_create_failure";
627
628 --error ER_FILE_NOT_FOUND
629 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
630
631 SET SESSION debug="-d,fil_space_create_failure";
632
633 DROP TABLE test_wl5522.t1;
634
635 perl;
636 require 'include/innodb-util.inc';
637 ib_unlink_tablespace("test_wl5522", "t1");
638 EOF
639
640 #
641
642 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
643 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
644
645 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
646
647 --error ER_TABLESPACE_DISCARDED
648 SELECT COUNT(*) FROM test_wl5522.t1;
649
650 # Restore files
651 perl;
652 require 'include/innodb-util.inc';
653 ib_restore_tablespaces("test_wl5522", "t1");
654 EOF
655
656 SET SESSION debug="+d,dict_tf_to_fsp_flags_failure";
657
658 --error ER_FILE_NOT_FOUND
659 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
660
661 SET SESSION debug="-d,dict_tf_to_fsp_flags_failure";
662
663 DROP TABLE test_wl5522.t1;
664
665 perl;
666 require 'include/innodb-util.inc';
667 ib_unlink_tablespace("test_wl5522", "t1");
668 EOF
669
670 #
671
672 CREATE TABLE test_wl5522.t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE = Innodb
673 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4;
674
675 ALTER TABLE test_wl5522.t1 DISCARD TABLESPACE;
676
677 --error ER_TABLESPACE_DISCARDED
678 SELECT COUNT(*) FROM test_wl5522.t1;
679
680 # Restore files
681 perl;
682 require 'include/innodb-util.inc';
683 ib_restore_tablespaces("test_wl5522", "t1");
684 EOF
685
686 SET SESSION debug="+d,fsp_flags_is_valid_failure";
687
688 --replace_regex /'.*t1.cfg'/'t1.cfg'/
689
690 --error ER_INTERNAL_ERROR
691 ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE;
692
693 SET SESSION debug="-d,fsp_flags_is_valid_failure";
694
695 DROP TABLE test_wl5522.t1;
696
697 perl;
698 require 'include/innodb-util.inc';
699 ib_unlink_tablespace("test_wl5522", "t1");
700 EOF
701
702
703 DROP DATABASE test_wl5522;
704
705 set global innodb_monitor_disable = all;
706 set global innodb_monitor_reset_all = all;
707
708 --disable_query_log
709 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Cannot open datafile for read-only:");
710 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Could not find a valid tablespace file for");
711 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.");
712 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Operating system error number 2 in a file operation.");
713 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* The error means the system cannot find the path specified");
714 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Unsupported tablespace format");
715 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Cannot calculate statistics for table .* because the \.ibd file is missing");
716 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Ignoring tablespace `test_wl5522/t1` because it could not be opened.");
717 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Monitor ibuf_merges is already enabled");
718 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Monitor ibuf_merges_insert is already enabled");
719 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Tablespace for table .* is set as discarded.");
720 call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* Tablespace .*, name '.*', file '.*' is missing");
721 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Trying to import a tablespace, but could not open the tablespace file");
722 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* Operating system error number 32 in a file operation.");
723 call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* The error means that another program is using InnoDB's files.");
724 --enable_query_log
725
726 #cleanup
727 --remove_file $MYSQLTEST_VARDIR/tmp/t1.cfg
728 --remove_file $MYSQLTEST_VARDIR/tmp/t1.ibd
729
730 eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
731 --source include/innodb_monitor_restore.inc