|
| 1 | +# Test resizing the InnoDB redo log. |
| 2 | + |
| 3 | +--source include/have_innodb.inc |
| 4 | + |
| 5 | +# Embedded server does not support crashing |
| 6 | +--source include/not_embedded.inc |
| 7 | +# Avoid CrashReporter popup on Mac |
| 8 | +--source include/not_crashrep.inc |
| 9 | +# innodb-force-recovery-crash needs debug |
| 10 | +--source include/have_debug.inc |
| 11 | + |
| 12 | +if (`SELECT @@innodb_log_file_size = 1048576`) { |
| 13 | + --skip Test requires innodb_log_file_size>1M. |
| 14 | +} |
| 15 | + |
| 16 | +CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 17 | +BEGIN; |
| 18 | +INSERT INTO t1 VALUES (42); |
| 19 | + |
| 20 | +let $restart_parameters = --innodb-log-file-size=6M; |
| 21 | +--source include/kill_and_restart_mysqld.inc |
| 22 | + |
| 23 | +SELECT * FROM t1; |
| 24 | + |
| 25 | +INSERT INTO t1 VALUES (42); |
| 26 | +BEGIN; |
| 27 | +DELETE FROM t1; |
| 28 | + |
| 29 | +let $restart_parameters = --innodb-log-files-in-group=3 --innodb-log-file-size=5M; |
| 30 | +--source include/kill_and_restart_mysqld.inc |
| 31 | + |
| 32 | +SELECT * FROM t1; |
| 33 | + |
| 34 | +INSERT INTO t1 VALUES (123); |
| 35 | + |
| 36 | +let MYSQLD_DATADIR= `select @@datadir`; |
| 37 | +let SEARCH_ABORT = NOT FOUND; |
| 38 | +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err; |
| 39 | +# MDEV-11689 FIXME: add --core-file to $args, and remove all ,134 below |
| 40 | +let $args=--innodb --unknown-option --loose-console > $SEARCH_FILE 2>&1; |
| 41 | +let $crash=$args --innodb-force-recovery-crash; |
| 42 | + |
| 43 | +BEGIN; |
| 44 | +DELETE FROM t1; |
| 45 | + |
| 46 | +--source include/kill_mysqld.inc |
| 47 | + |
| 48 | +--error 2 |
| 49 | +--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar |
| 50 | +let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir; |
| 51 | +--source include/search_pattern_in_file.inc |
| 52 | +--remove_file $SEARCH_FILE |
| 53 | + |
| 54 | +--echo --innodb-force-recovery-crash=1 |
| 55 | +--error 3,134 |
| 56 | +--exec $MYSQLD_CMD $crash=1 |
| 57 | +let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; |
| 58 | +--source include/search_pattern_in_file.inc |
| 59 | +--remove_file $SEARCH_FILE |
| 60 | +--echo --innodb-force-recovery-crash=3 |
| 61 | +--error 3,134 |
| 62 | +--exec $MYSQLD_CMD $crash=3 |
| 63 | +let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; |
| 64 | +--source include/search_pattern_in_file.inc |
| 65 | +--remove_file $SEARCH_FILE |
| 66 | + |
| 67 | +--error 2 |
| 68 | +--exec $MYSQLD_CMD $args --innodb-read-only |
| 69 | +let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; |
| 70 | +--source include/search_pattern_in_file.inc |
| 71 | +--remove_file $SEARCH_FILE |
| 72 | + |
| 73 | +--echo --innodb-force-recovery-crash=4 |
| 74 | +--error 3,134 |
| 75 | +--exec $MYSQLD_CMD $crash=4 |
| 76 | +let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; |
| 77 | +--source include/search_pattern_in_file.inc |
| 78 | +let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; |
| 79 | +--source include/search_pattern_in_file.inc |
| 80 | +--remove_file $SEARCH_FILE |
| 81 | +--echo --innodb-force-recovery-crash=5 |
| 82 | +--error 3,134 |
| 83 | +--exec $MYSQLD_CMD $crash=5 |
| 84 | +let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; |
| 85 | +--source include/search_pattern_in_file.inc |
| 86 | +let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; |
| 87 | +--source include/search_pattern_in_file.inc |
| 88 | +--remove_file $SEARCH_FILE |
| 89 | + |
| 90 | +--error 2 |
| 91 | +--exec $MYSQLD_CMD $args --innodb-read-only |
| 92 | +let SEARCH_PATTERN= InnoDB: innodb_read_only prevents crash recovery; |
| 93 | +--source include/search_pattern_in_file.inc |
| 94 | +--remove_file $SEARCH_FILE |
| 95 | + |
| 96 | +--echo --innodb-force-recovery-crash=6 |
| 97 | +--error 3,134 |
| 98 | +--exec $MYSQLD_CMD $crash=6 |
| 99 | +let SEARCH_PATTERN= InnoDB: Starting an apply batch of log records; |
| 100 | +--source include/search_pattern_in_file.inc |
| 101 | +let SEARCH_PATTERN= InnoDB: Resizing redo log from 3\*[0-9]+ to 2\*[0-9]+ pages; |
| 102 | +--source include/search_pattern_in_file.inc |
| 103 | +--remove_file $SEARCH_FILE |
| 104 | +--echo --innodb-force-recovery-crash=7 |
| 105 | +--error 3,134 |
| 106 | +--exec $MYSQLD_CMD $crash=7 |
| 107 | +# this crashes right after deleting all log files |
| 108 | +--remove_file $SEARCH_FILE |
| 109 | + |
| 110 | +--error 2 |
| 111 | +--exec $MYSQLD_CMD $args --innodb-read-only |
| 112 | +let SEARCH_PATTERN= InnoDB: Cannot create log files in read-only mode; |
| 113 | +--source include/search_pattern_in_file.inc |
| 114 | +--remove_file $SEARCH_FILE |
| 115 | + |
| 116 | +--echo --innodb-force-recovery-crash=8 |
| 117 | +--error 3,134 |
| 118 | +--exec $MYSQLD_CMD $crash=8 |
| 119 | +let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to; |
| 120 | +--source include/search_pattern_in_file.inc |
| 121 | +--remove_file $SEARCH_FILE |
| 122 | +--echo --innodb-force-recovery-crash=9 |
| 123 | +--error 3,134 |
| 124 | +--exec $MYSQLD_CMD $crash=9 |
| 125 | +let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to; |
| 126 | +--source include/search_pattern_in_file.inc |
| 127 | +--remove_file $SEARCH_FILE |
| 128 | + |
| 129 | +# We should have perfectly synced files here. |
| 130 | +# Rename the log files, and trigger an error in recovery. |
| 131 | +--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0 |
| 132 | +--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden |
| 133 | +--error 2,134 |
| 134 | +--exec $MYSQLD_CMD $args |
| 135 | +let SEARCH_PATTERN= InnoDB: Only one log file found; |
| 136 | +--source include/search_pattern_in_file.inc |
| 137 | +--remove_file $SEARCH_FILE |
| 138 | +--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101 |
| 139 | + |
| 140 | +perl; |
| 141 | +die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0"); |
| 142 | +print FILE "garbage"; |
| 143 | +close(FILE); |
| 144 | +EOF |
| 145 | +--error 2,134 |
| 146 | +--exec $MYSQLD_CMD $args |
| 147 | +let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile0 size 7 is not a multiple of innodb_page_size; |
| 148 | +--source include/search_pattern_in_file.inc |
| 149 | +--remove_file $SEARCH_FILE |
| 150 | +--remove_file $MYSQLD_DATADIR/ib_logfile0 |
| 151 | +--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0 |
| 152 | + |
| 153 | +perl; |
| 154 | +die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile1"); |
| 155 | +print FILE "junkfill" x 131072; |
| 156 | +close(FILE); |
| 157 | +EOF |
| 158 | + |
| 159 | +--error 2,134 |
| 160 | +--exec $MYSQLD_CMD $args |
| 161 | +let SEARCH_PATTERN= InnoDB: Log file .*ib_logfile1 is of different size 1048576 bytes than other log files; |
| 162 | +--source include/search_pattern_in_file.inc |
| 163 | +--remove_file $SEARCH_FILE |
| 164 | +--remove_file $MYSQLD_DATADIR/ib_logfile1 |
| 165 | +--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101 |
| 166 | +--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1 |
| 167 | + |
| 168 | +--echo --innodb-force-recovery-crash=10 |
| 169 | +--error 3,134 |
| 170 | +--exec $MYSQLD_CMD $crash=10 |
| 171 | +let SEARCH_PATTERN= InnoDB: Setting log file .*ib_logfile[0-9]+ size to; |
| 172 | +--source include/search_pattern_in_file.inc |
| 173 | +let SEARCH_PATTERN= InnoDB: Renaming log file .*ib_logfile101 to .*ib_logfile0; |
| 174 | +--source include/search_pattern_in_file.inc |
| 175 | +--remove_file $SEARCH_FILE |
| 176 | + |
| 177 | +--let $restart_parameters= |
| 178 | +--source include/start_mysqld.inc |
| 179 | + |
| 180 | +--disable_query_log |
| 181 | +call mtr.add_suppression("InnoDB: Resizing redo log"); |
| 182 | +call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files"); |
| 183 | +call mtr.add_suppression("InnoDB: New log files created"); |
| 184 | +call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles"); |
| 185 | +--enable_query_log |
| 186 | + |
| 187 | +SELECT * FROM t1; |
| 188 | +DROP TABLE t1; |
0 commit comments