1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
# Initialize new data directory...
# Restart MySQL using the new data directory...
# restart: --datadir=tmp/log_corruption --log-error=my_restart.err
# Prepare schema used in the tests.
# Ensure there is a lot of free space in the redo log.
SET GLOBAL innodb_log_checkpoint_now = ON;
# Disable checkpointing.
SET GLOBAL innodb_checkpoint_disabled = ON;
# Create connection which generates spam to the redo log.
CALL log_spammer();
# Create at least few redo records...
CREATE TABLE t (a INT) ENGINE=InnoDB;
INSERT INTO t(a) VALUES(42);
# Kill MySQL...
# Kill the server
# Remove unused redo files and prepare saved_datadir...
############################################################################################
# Case 1. Corrupt a mini-transaction after the checkpoint by changing type of redo record.
# Start recovery and observe information about the corrupted redo record (invalid
# type of redo record, equal to 0).
############################################################################################
# Start MySQL...
# Verify...
Pattern "CORRUPT LOG RECORD FOUND" found
Pattern "Log record type 0, page .*:.*. Log parsing proceeded successfully up to RECOVERED_LSN" found
Pattern "Apply batch completed" not found
Pattern "innodb-unknown-compound-v" not found
############################################################################################
# Case 2. Verify that recovery could be re-executed from previous checkpoint and go further
# after the corrupted log block is fixed.
############################################################################################
# Fix the corrupted log record type...
# Start MySQL...
# Verify...
Pattern "Database was not shutdown normally" found
Pattern "Starting crash recovery" found
Pattern "Applying a batch of.*redo log records" found
Pattern "Apply batch completed" found
Pattern "innodb-unknown-compound-v" found
# Remove the data directory...
############################################################################################
# Case 3. Check how recovery stops on log block with invalid checksum.
############################################################################################
# Restore the data directory from before recovery...
# Corrupt checksum...
# Start MySQL...
# Verify...
Pattern "Log block CORRUPTED_LOG_BLOCK at lsn SCANNED_LSN has valid header, but checksum field contains .*, should be .*" found
Pattern "Doing recovery: scanned up to log sequence number SCANNED_LSN" found
Pattern "innodb-unknown-compound-v" not found
############################################################################################
# Case 4. Check how recovery stops on log block with invalid block_no.
############################################################################################
# Restore the data directory from before recovery...
# Corrupt the block_no...
# Start MySQL...
# Verify...
Pattern "Database was not shutdown normally" found
Pattern "Starting crash recovery" found
Pattern "Doing recovery: scanned up to log sequence number SCANNED_LSN" found
Pattern "Applying a batch of.*redo log records" found
Pattern "Apply batch completed" found
Pattern "innodb-unknown-compound-v" not found
############################################################################################
# Cleanup...
# Start MySQL...
# restart:
|