| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/no_valgrind_without_big.inc |
| 3 |
|
| 4 |
call mtr.add_suppression("Table `test`.`t2` should have 2 indexes but the tablespace has 1 indexes"); |
| 5 |
call mtr.add_suppression("Index for table 't2' is corrupt; try to repair it"); |
| 6 |
call mtr.add_suppression("Trying to read .* bytes at .* outside the bounds of the file: \\..test.t2\\.ibd"); |
| 7 |
call mtr.add_suppression("InnoDB: File '.*test/t2\\.ibd' is corrupted"); |
| 8 |
|
| 9 |
let MYSQLD_DATADIR = `SELECT @@datadir`; |
| 10 |
|
| 11 |
CREATE TABLE t1 ( |
| 12 |
id INT AUTO_INCREMENT PRIMARY KEY, |
| 13 |
not_id INT, |
| 14 |
data CHAR(255), |
| 15 |
data2 BLOB |
| 16 |
) ENGINE=INNODB; |
| 17 |
|
| 18 |
--disable_query_log |
| 19 |
--let i = 0 |
| 20 |
while ($i != 1000) { |
| 21 |
eval INSERT INTO t1 VALUES (DEFAULT, $i, REPEAT('b', 255), REPEAT('a', 5000)); |
| 22 |
--inc $i |
| 23 |
} |
| 24 |
--enable_query_log |
| 25 |
|
| 26 |
ALTER TABLE t1 MODIFY not_id INT UNIQUE KEY; |
| 27 |
|
| 28 |
connect (purge_control,localhost,root,,); |
| 29 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 30 |
connection default; |
| 31 |
|
| 32 |
DELETE FROM t1 WHERE id % 2 = 1; |
| 33 |
|
| 34 |
FLUSH TABLES t1 FOR EXPORT; |
| 35 |
|
| 36 |
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/tmp.ibd |
| 37 |
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/tmp.cfg |
| 38 |
|
| 39 |
perl; |
| 40 |
use strict; |
| 41 |
die unless open(FILE, "+<$ENV{MYSQLD_DATADIR}/test/tmp.ibd"); |
| 42 |
die unless truncate(FILE, 16384*23); |
| 43 |
close(FILE); |
| 44 |
EOF |
| 45 |
|
| 46 |
UNLOCK TABLES; |
| 47 |
connection purge_control; |
| 48 |
COMMIT; |
| 49 |
connection default; |
| 50 |
DROP TABLE t1; |
| 51 |
|
| 52 |
CREATE TABLE t2 ( |
| 53 |
id INT AUTO_INCREMENT PRIMARY KEY, |
| 54 |
not_id INT UNIQUE KEY, |
| 55 |
data CHAR(255), |
| 56 |
data2 BLOB |
| 57 |
) ENGINE=INNODB; |
| 58 |
|
| 59 |
ALTER TABLE t2 DISCARD TABLESPACE; |
| 60 |
|
| 61 |
--move_file $MYSQLD_DATADIR/test/tmp.ibd $MYSQLD_DATADIR/test/t2.ibd |
| 62 |
--move_file $MYSQLD_DATADIR/test/tmp.cfg $MYSQLD_DATADIR/test/t2.cfg |
| 63 |
|
| 64 |
--error ER_NOT_KEYFILE |
| 65 |
ALTER TABLE t2 IMPORT TABLESPACE; |
| 66 |
|
| 67 |
DROP TABLE t2; |