| 1 |
# Initialize new data directory... |
| 2 |
# Restart on the new data directory... |
| 3 |
# restart: --datadir=tmp/log_corruption_1 --log-error=my_restart.err |
| 4 |
# Create table and row... |
| 5 |
CREATE TABLE t (a INT AUTO_INCREMENT PRIMARY KEY, b INT, INDEX b_idx(b)) |
| 6 |
ENGINE = InnoDB STATS_PERSISTENT = 0; |
| 7 |
INSERT INTO t VALUES(1,1); |
| 8 |
CHECK TABLE t; |
| 9 |
Table Op Msg_type Msg_text |
| 10 |
test.t check status OK |
| 11 |
############################################################################################ |
| 12 |
# Case 1: Crash after redo logging information about corrupted clustered index. |
| 13 |
############################################################################################ |
| 14 |
# Ensure there is a lot of free space in the redo log. |
| 15 |
SET GLOBAL innodb_log_checkpoint_now = ON; |
| 16 |
# Disable checkpointing. |
| 17 |
SET GLOBAL innodb_checkpoint_disabled = ON; |
| 18 |
# Enable crash code... |
| 19 |
SET SESSION DEBUG = "+d,log_corruption_crash_1"; |
| 20 |
SET SESSION DEBUG = "+d,dict_set_index_corrupted"; |
| 21 |
# Run CHECK TABLE (expecting a crash)... |
| 22 |
CHECK TABLE t; |
| 23 |
# Verify that InnoDB can recover. |
| 24 |
# restart: --datadir=tmp/log_corruption_1 --log-error=my_restart.err |
| 25 |
Pattern "CORRUPT LOG RECORD FOUND" not found |
| 26 |
CHECK TABLE t; |
| 27 |
Table Op Msg_type Msg_text |
| 28 |
test.t check Warning InnoDB: Index b_idx is marked as corrupted |
| 29 |
test.t check error Corrupt |
| 30 |
ALTER TABLE t DROP INDEX b_idx; |
| 31 |
CHECK TABLE t; |
| 32 |
Table Op Msg_type Msg_text |
| 33 |
test.t check status OK |
| 34 |
ALTER TABLE t ADD INDEX b_idx (b); |
| 35 |
############################################################################################ |
| 36 |
# Case 2: Crash after redo logging *corrupted* information about corrupted clustered index |
| 37 |
# (logging number of indexes corrupted = 100 > MAX_INDEXES). |
| 38 |
############################################################################################ |
| 39 |
# Ensure there is a lot of free space in the redo log. |
| 40 |
SET GLOBAL innodb_log_checkpoint_now = ON; |
| 41 |
# Disable checkpointing. |
| 42 |
SET GLOBAL innodb_checkpoint_disabled = ON; |
| 43 |
# Enable crash code... |
| 44 |
SET SESSION DEBUG = "+d,log_corruption_crash_1"; |
| 45 |
SET SESSION DEBUG = "+d,log_corruption_1"; |
| 46 |
SET SESSION DEBUG = "+d,dict_set_clust_index_corrupted"; |
| 47 |
# Run CHECK TABLE (expecting a crash)... |
| 48 |
CHECK TABLE t; |
| 49 |
# Verify that InnoDB cannot recover, because it encounters the corrupted redo record. |
| 50 |
# Matching the server logs for corrupted redo logs... |
| 51 |
Pattern "CORRUPT LOG RECORD FOUND" found |
| 52 |
Pattern "Hex dump starting .* bytes before and ending .* bytes after the corrupted record" found |
| 53 |
Pattern "innodb-unknown-compound-v" not found |
| 54 |
############################################################################################ |
| 55 |
# Cleanup... |
| 56 |
# restart: |