| 1 |
# Test resizing the InnoDB redo log. |
| 2 |
--source include/innodb_page_size_small.inc |
| 3 |
# Embedded server tests do not support restarting |
| 4 |
--source include/not_embedded.inc |
| 5 |
--source include/maybe_debug.inc |
| 6 |
# This test is slow on buildbot. |
| 7 |
--source include/big_test.inc |
| 8 |
|
| 9 |
--disable_query_log |
| 10 |
call mtr.add_suppression("syntax error in innodb_log_group_home_dir"); |
| 11 |
call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); |
| 12 |
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); |
| 13 |
call mtr.add_suppression("Fewer engines are enabled now than were before the crash"); |
| 14 |
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); |
| 15 |
call mtr.add_suppression("InnoDB: innodb_read_only prevents crash recovery"); |
| 16 |
call mtr.add_suppression("InnoDB: Log file .*ib_logfile1.* size"); |
| 17 |
call mtr.add_suppression("InnoDB: File .*ib_logfile0 (is too small|was not found)"); |
| 18 |
call mtr.add_suppression("InnoDB: Expecting only ib_logfile0"); |
| 19 |
FLUSH TABLES; |
| 20 |
--enable_query_log |
| 21 |
let MYSQLD_DATADIR= `select @@datadir`; |
| 22 |
SET GLOBAL innodb_file_per_table=0; |
| 23 |
CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB; |
| 24 |
|
| 25 |
--source include/shutdown_mysqld.inc |
| 26 |
perl; |
| 27 |
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; |
| 28 |
my $file = "$ENV{MYSQLD_DATADIR}ib_logfile0"; |
| 29 |
open(FILE, "<$file") || die "Unable to open $file\n"; |
| 30 |
seek(FILE, 4096, 0) || die "Unable to seek $file\n"; |
| 31 |
die unless read(FILE, $_, 8) == 8; |
| 32 |
my ($lsn_hi,$lsn_lo) = unpack("NN", $_); |
| 33 |
seek(FILE, 8192, 0) || die "Unable to seek $file\n"; |
| 34 |
die unless read(FILE, $_, 8) == 8; |
| 35 |
my ($cp2hi,$cp2lo) = unpack("NN", $_); |
| 36 |
if ($cp2hi < $lsn_hi) {} |
| 37 |
elsif ($cp2hi > $lsn_hi || $cp2lo > $lsn_lo) |
| 38 |
{ $lsn_hi=$cp2hi;$lsn_lo=$cp2lo; } |
| 39 |
close(FILE); |
| 40 |
open(FILE, ">", $file) or die "Unable to open $file\n"; |
| 41 |
binmode FILE; |
| 42 |
my $polynomial = 0x82f63b78; # CRC-32C |
| 43 |
my ($header, $checkpoint, $log); |
| 44 |
$header = "Phys" . pack("x[4]NN", $lsn_hi, $lsn_lo) . |
| 45 |
"some Perl code" . pack("x[478]"); |
| 46 |
$header .= pack("Nx[3584]", mycrc32($header, 0, $polynomial)); |
| 47 |
$checkpoint = pack("NNNNx[44]", $lsn_hi, $lsn_lo, $lsn_hi, $lsn_lo); |
| 48 |
$checkpoint .= pack("Nx[8128]", mycrc32($checkpoint, 0, $polynomial)); |
| 49 |
$log = pack("CxxNN", 0xfa, $lsn_hi, $lsn_lo); |
| 50 |
$log .= pack("CN", 1, mycrc32($log, 0, $polynomial)); |
| 51 |
print FILE $header, $checkpoint, $log; |
| 52 |
close(FILE) or die "Unable to close $file\n"; |
| 53 |
EOF |
| 54 |
|
| 55 |
let $check_no_innodb=SELECT * FROM INFORMATION_SCHEMA.ENGINES |
| 56 |
WHERE engine = 'innodb' |
| 57 |
AND support IN ('YES', 'DEFAULT', 'ENABLED'); |
| 58 |
|
| 59 |
--let $restart_parameters= --innodb-log-file-size=4m |
| 60 |
--source include/start_mysqld.inc |
| 61 |
|
| 62 |
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; |
| 63 |
CHECK TABLE t1; |
| 64 |
|
| 65 |
--let $restart_parameters= --innodb-log-file-size=20M |
| 66 |
--source include/restart_mysqld.inc |
| 67 |
|
| 68 |
BEGIN; |
| 69 |
INSERT INTO t1 VALUES (42); |
| 70 |
|
| 71 |
let $restart_parameters = --innodb-log-file-size=12M; |
| 72 |
let $shutdown_timeout=0; |
| 73 |
--source include/restart_mysqld.inc |
| 74 |
|
| 75 |
SELECT * FROM t1; |
| 76 |
|
| 77 |
INSERT INTO t1 VALUES (42); |
| 78 |
BEGIN; |
| 79 |
DELETE FROM t1; |
| 80 |
|
| 81 |
let $restart_parameters = --innodb-log-file-size=5M; |
| 82 |
--source include/restart_mysqld.inc |
| 83 |
let $shutdown_timeout=; |
| 84 |
|
| 85 |
SELECT * FROM t1; |
| 86 |
|
| 87 |
INSERT INTO t1 VALUES (0),(123); |
| 88 |
|
| 89 |
let SEARCH_ABORT = NOT FOUND; |
| 90 |
|
| 91 |
BEGIN; |
| 92 |
if ($have_debug) { |
| 93 |
SET GLOBAL innodb_limit_optimistic_insert_debug=2; |
| 94 |
INSERT INTO t1 VALUES (124),(125),(126),(127),(128),(129); |
| 95 |
} |
| 96 |
DELETE FROM t1 WHERE a>0; |
| 97 |
|
| 98 |
--echo # Persist the state of the above incomplete transaction by |
| 99 |
--echo # causing a redo log write for another transaction. |
| 100 |
--connect(con1, localhost, root) |
| 101 |
SET GLOBAL innodb_flush_log_at_trx_commit=1; |
| 102 |
DELETE FROM t1 WHERE a=0; |
| 103 |
--disconnect con1 |
| 104 |
--connection default |
| 105 |
|
| 106 |
--source include/kill_mysqld.inc |
| 107 |
|
| 108 |
--let $restart_parameters= --innodb-log-group-home-dir=foo\;bar |
| 109 |
--source include/start_mysqld.inc |
| 110 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 111 |
SELECT * FROM t1; |
| 112 |
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir; |
| 113 |
--source include/search_pattern_in_file.inc |
| 114 |
--let $restart_parameters= |
| 115 |
|
| 116 |
if ($have_debug) { |
| 117 |
--let $restart_parameters= --debug-dbug=d,innodb_log_abort_1 |
| 118 |
--source include/restart_mysqld.inc |
| 119 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 120 |
SELECT * FROM t1; |
| 121 |
let SEARCH_PATTERN= InnoDB: Starting crash recovery from checkpoint LSN=.*; |
| 122 |
--source include/search_pattern_in_file.inc |
| 123 |
let $restart_parameters = --innodb-log-file-size=5M; |
| 124 |
} |
| 125 |
|
| 126 |
--source include/restart_mysqld.inc |
| 127 |
|
| 128 |
SELECT * FROM t1; |
| 129 |
|
| 130 |
if ($have_debug) { |
| 131 |
--let $restart_parameters= --debug-dbug=d,innodb_log_abort_5 |
| 132 |
--source include/restart_mysqld.inc |
| 133 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 134 |
SELECT * FROM t1; |
| 135 |
let SEARCH_PATTERN= redo log from 5\\.000MiB to [0-9.]*[KMGT]iB; |
| 136 |
--source include/search_pattern_in_file.inc |
| 137 |
|
| 138 |
--let $restart_parameters= |
| 139 |
--source include/restart_mysqld.inc |
| 140 |
SELECT * FROM t1; |
| 141 |
} |
| 142 |
|
| 143 |
# Trigger an error in recovery. |
| 144 |
|
| 145 |
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101 |
| 146 |
--write_file $MYSQLD_DATADIR/ib_logfile0 |
| 147 |
garbage |
| 148 |
EOF |
| 149 |
|
| 150 |
--let $restart_parameters= |
| 151 |
--source include/restart_mysqld.inc |
| 152 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 153 |
SELECT * FROM t1; |
| 154 |
let SEARCH_PATTERN= InnoDB: File .*ib_logfile0 is too small; |
| 155 |
--source include/search_pattern_in_file.inc |
| 156 |
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile1 |
| 157 |
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0 |
| 158 |
|
| 159 |
--source include/restart_mysqld.inc |
| 160 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 161 |
SELECT * FROM t1; |
| 162 |
let SEARCH_PATTERN= InnoDB: Expecting only ib_logfile0; |
| 163 |
--source include/search_pattern_in_file.inc |
| 164 |
|
| 165 |
--remove_file $MYSQLD_DATADIR/ib_logfile1 |
| 166 |
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101 |
| 167 |
|
| 168 |
--source include/restart_mysqld.inc |
| 169 |
--error ER_UNKNOWN_STORAGE_ENGINE |
| 170 |
let SEARCH_PATTERN= InnoDB: File .*ib_logfile0 was not found; |
| 171 |
--source include/search_pattern_in_file.inc |
| 172 |
--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0 |
| 173 |
|
| 174 |
--source include/restart_mysqld.inc |
| 175 |
SELECT * FROM t1; |
| 176 |
DROP TABLE t1; |
| 177 |
|
| 178 |
--let SEARCH_PATTERN= InnoDB: Resizing redo log from 5\\.000MiB to [0-9.]*[KMGT]iB; LSN=\\d+\\b |
| 179 |
--source include/search_pattern_in_file.inc |