| 1 |
# This mtr test checks how InnoDB handles corrupted redo log files, |
| 2 |
# if these files were created using the current redo log format. |
| 3 |
# --------------------------- |
| 4 |
# |
| 5 |
# For older redo formats, recovery reports that redo log isn't clean, |
| 6 |
# and clean shutdown must be performed using older version of MySQL. |
| 7 |
# However, scenarios for older redo formats are NOT part of this test. |
| 8 |
# They are located in log_5_7_8.test, log_5_7_9.test, ... |
| 9 |
|
| 10 |
# disabling checkpoints: |
| 11 |
--source include/have_debug.inc |
| 12 |
|
| 13 |
# perl: support for Q> in pack(), and 64-bit int: |
| 14 |
--source include/have_64bit.inc |
| 15 |
|
| 16 |
--source ../include/redo_log_error_patterns.inc |
| 17 |
|
| 18 |
let $tmp_dir = $MYSQLTEST_VARDIR/tmp; |
| 19 |
|
| 20 |
let MYSQLD_DATADIR = $tmp_dir/log_crash; |
| 21 |
let MYSQLD_ERROR_LOG = $tmp_dir/my_restart.err; |
| 22 |
let SEARCH_FILE = $MYSQLD_ERROR_LOG; |
| 23 |
|
| 24 |
let $INNODB_PAGE_SIZE = `select @@innodb_page_size`; |
| 25 |
let $MYSQLD_EXTRA_ARGS = --innodb_page_size=$INNODB_PAGE_SIZE; |
| 26 |
--echo # Initialize new data directory... |
| 27 |
--source include/initialize_datadir.inc |
| 28 |
|
| 29 |
--echo # Restart MySQL using the new data directory... |
| 30 |
let $restart_parameters = restart: --datadir=$MYSQLD_DATADIR --log-error=$MYSQLD_ERROR_LOG; |
| 31 |
--replace_result $MYSQLD_ERROR_LOG my_restart.err $MYSQLD_DATADIR tmp/log_crash |
| 32 |
--source include/restart_mysqld.inc |
| 33 |
|
| 34 |
--echo # Prepare schema used in the tests. |
| 35 |
--source include/ib_log_spammer_init.inc |
| 36 |
|
| 37 |
--echo # Ensure there is a lot of free space in the redo log. |
| 38 |
SET GLOBAL innodb_log_checkpoint_now = ON; |
| 39 |
|
| 40 |
--echo # Disable checkpointing. |
| 41 |
SET GLOBAL innodb_checkpoint_disabled = ON; |
| 42 |
|
| 43 |
--echo # Create connection which generates spam to the redo log. |
| 44 |
--connect(C1,localhost,root,,test) |
| 45 |
--send CALL log_spammer() |
| 46 |
--connection default |
| 47 |
|
| 48 |
--echo # Create at least few redo records... |
| 49 |
CREATE TABLE t (a INT) ENGINE=InnoDB; |
| 50 |
INSERT INTO t(a) VALUES(42); |
| 51 |
|
| 52 |
--echo # Kill MySQL... |
| 53 |
--source include/kill_mysqld.inc |
| 54 |
let $restart_parameters = restart:; |
| 55 |
|
| 56 |
--echo # Start MySQL... |
| 57 |
--error 1,42 |
| 58 |
--exec $MYSQLD_CMD $MYSQLD_ARGS --$UNKNOWN_PARAM |
| 59 |
|
| 60 |
--echo # Verify... |
| 61 |
|
| 62 |
let SEARCH_PATTERN = $PATTERN_DATABASE_NOT_CLEAN; |
| 63 |
# Expected: found |
| 64 |
--source include/search_pattern.inc |
| 65 |
|
| 66 |
let SEARCH_PATTERN = $PATTERN_STARTING_CRASH_RECOVERY; |
| 67 |
# Expected: found |
| 68 |
--source include/search_pattern.inc |
| 69 |
|
| 70 |
let SEARCH_PATTERN = $PATTERN_APPLYING_BATCH; |
| 71 |
# Expected: found |
| 72 |
--source include/search_pattern.inc |
| 73 |
|
| 74 |
let SEARCH_PATTERN = $PATTERN_APPLY_BATCH_COMPLETED; |
| 75 |
# Expected: found |
| 76 |
--source include/search_pattern.inc |
| 77 |
|
| 78 |
let SEARCH_PATTERN = $PATTERN_UNKNOWN_PARAM; |
| 79 |
# Expected: found |
| 80 |
--source include/search_pattern.inc |
| 81 |
|
| 82 |
--echo # Remove the data directory... |
| 83 |
--force-rmdir $MYSQLD_DATADIR |
| 84 |
|
| 85 |
--echo ############################################################################################ |
| 86 |
|
| 87 |
--echo # Cleanup... |
| 88 |
--remove_file $SEARCH_FILE |
| 89 |
let SEARCH_FILE=; |
| 90 |
let SEARCH_PATTERN=; |
| 91 |
let MYSQLD_ERROR_LOG=; |
| 92 |
let MYSQLD_DATADIR=; |
| 93 |
|
| 94 |
--echo # Start MySQL... |
| 95 |
--source include/start_mysqld.inc |