| 1 |
# |
| 2 |
# Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP |
| 3 |
# |
| 4 |
SET GLOBAL innodb_file_per_table=1; |
| 5 |
CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 6 |
CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
| 7 |
INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8); |
| 8 |
# Cleanly shutdown mysqld |
| 9 |
# Corrupt FIL_PAGE_OFFSET in bug16720368.ibd, |
| 10 |
# and update the checksum to the "don't care" value. |
| 11 |
# Restart mysqld |
| 12 |
# restart |
| 13 |
# This will succeed after a clean shutdown, due to |
| 14 |
# fil_open_single_table_tablespace(check_space_id=FALSE). |
| 15 |
SELECT COUNT(*) FROM bug16720368; |
| 16 |
COUNT(*) |
| 17 |
8 |
| 18 |
INSERT INTO bug16720368_1 VALUES(1); |
| 19 |
# Kill and restart |
| 20 |
# The table is unaccessible, because after a crash we will |
| 21 |
# validate the tablespace header. |
| 22 |
SELECT COUNT(*) FROM bug16720368; |
| 23 |
ERROR HY000: Tablespace is missing for table `test`.`bug16720368`. |
| 24 |
INSERT INTO bug16720368 VALUES(0,1); |
| 25 |
ERROR HY000: Tablespace is missing for table `test`.`bug16720368`. |
| 26 |
# Kill and restart: --innodb-force-recovery=3 |
| 27 |
# The table is readable thanks to innodb-force-recovery. |
| 28 |
SELECT COUNT(*) FROM bug16720368; |
| 29 |
COUNT(*) |
| 30 |
8 |
| 31 |
INSERT INTO bug16720368 VALUES(0,1); |
| 32 |
ERROR HY000: Operation not allowed when innodb_force_recovery > 0. |
| 33 |
# Shut down the server cleanly to hide the corruption. |
| 34 |
# restart |
| 35 |
# The table is accessible, because after a clean shutdown we will |
| 36 |
# NOT validate the tablespace header. |
| 37 |
# We can modify the existing pages, but we cannot allocate or free |
| 38 |
# any pages, because that would hit the corruption on page 0. |
| 39 |
SELECT COUNT(*) FROM bug16720368; |
| 40 |
COUNT(*) |
| 41 |
8 |
| 42 |
INSERT INTO bug16720368 VALUES(0,1); |
| 43 |
# Shut down the server to uncorrupt the data. |
| 44 |
# Restart the server after uncorrupting the file. |
| 45 |
# restart |
| 46 |
INSERT INTO bug16720368 VALUES(9,1); |
| 47 |
SELECT COUNT(*) FROM bug16720368; |
| 48 |
COUNT(*) |
| 49 |
10 |
| 50 |
DROP TABLE bug16720368, bug16720368_1; |
| 51 |
# |
| 52 |
# Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS, |
| 53 |
# DICT_TABLE_ADD_TO_CACHE |
| 54 |
# |
| 55 |
SET GLOBAL innodb_file_per_table=1; |
| 56 |
CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 57 |
BEGIN; |
| 58 |
INSERT INTO t1 VALUES(42); |
| 59 |
CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB; |
| 60 |
XA START 'x'; |
| 61 |
INSERT INTO bug16735660 VALUES(1),(2),(3); |
| 62 |
XA END 'x'; |
| 63 |
XA PREPARE 'x'; |
| 64 |
# Kill the server |
| 65 |
# Attempt to start without an *.ibd file. |
| 66 |
Pattern "\[ERROR\].*Could not find any file associated with the tablespace ID:.*" found |
| 67 |
# restart |
| 68 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; |
| 69 |
SELECT * FROM bug16735660; |
| 70 |
a |
| 71 |
1 |
| 72 |
2 |
| 73 |
3 |
| 74 |
XA RECOVER; |
| 75 |
formatID gtrid_length bqual_length data |
| 76 |
1 1 0 x |
| 77 |
XA ROLLBACK 'x'; |
| 78 |
SELECT * FROM bug16735660; |
| 79 |
a |
| 80 |
DROP TABLE bug16735660; |