File: innodb-log-file-size-1.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (299 lines) | stat: -rw-r--r-- 10,747 bytes parent folder | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
######## suite/innodb/t/innodb-wl6445-1                     ##########
#                                                                    #
# Testcase for worklog WL#6494: InnoDB should be able to work if     #
# redo log file size mismatch
# Test resizing the InnoDB redo log.
#                                                                    #
#                                                                    #
# Creation:                                                          #
# 2011-09-26 Implemented this test as part of WL#6494                #
#                                                                    #
######################################################################


# Not supported in embedded
--source include/not_embedded.inc

-- source include/have_innodb.inc
# Valgrind would complain about memory leaks when we crash on purpose.
--source include/not_valgrind.inc

if (`SELECT @@innodb_log_file_size = 2097152`) {
  --skip Test requires innodb_log_file_size!=2M.
}

# restart with innodb-fast-shutdown=2 to on stopping it , behave as crash
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
# Do something while server is down
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
--exec echo "restart: --innodb-fast-shutdown=2 --innodb-log-file-size=1M" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc


call mtr.add_suppression("InnoDB: Resizing redo log");
call mtr.add_suppression("InnoDB: Starting to delete and rewrite log files");
call mtr.add_suppression("InnoDB: New log files created");
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");

let MYSQLD_DATADIR =`SELECT @@datadir`;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
let $innodb_log_file_size = `SELECT @@innodb_log_file_size`;

SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;

SET GLOBAL innodb_file_format = `Barracuda`;
SELECT @@innodb_file_format;

SELECT @@innodb_log_file_size;
SELECT @@innodb_log_files_in_group;


# Testcase 1 - set log file size > existing size and innodb_log_files_in_group > old value
--disable_warnings
DROP DATABASE IF EXISTS db_wl6494;
--enable_warnings
CREATE DATABASE db_wl6494;
USE db_wl6494;

CREATE TABLE t1(id INT PRIMARY KEY,bfield blob) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,repeat('a',2000)),(2,repeat('b',2000)),
(3,repeat('c',2000));
START TRANSACTION;
INSERT INTO t1 VALUES (11,repeat('a',2000)),(12,repeat('b',2000)),
(13,repeat('c',2000));
SAVEPOINT A;
INSERT INTO t1 VALUES (21,repeat('a',2000)),(22,repeat('b',2000)),
(23,repeat('c',2000));
SAVEPOINT B;
SELECT id,LEFT(bfield,20) FROM t1;
ROLLBACK TO A;
COMMIT;
SELECT id,LEFT(bfield,20) FROM t1;

# restart with different redo log size
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
# Do something while server is down
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
# set log size from 2*1M to 5*2M
--exec echo "restart: --innodb-log-file-size=2M --innodb_log_files_in_group=5  --log-error=$MYSQLTEST_VARDIR/log/case1.err" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc

let SEARCH_FILE= $MYSQLTEST_VARDIR/log/case1.err;
let SEARCH_PATTERN= InnoDB: Starting crash recovery;
--source include/search_pattern_in_file.inc

# Check size of ib_logfile* when innodb_log_files_in_group is set
perl;
 my $dir = $ENV{'MYSQLD_DATADIR'};
 $file = "ib_logfile0";
 $size_in_MB = (-s "$dir/$file") / (1024 * 1024);;
 print "The size of the $file file: $size_in_MB \n";
 $file = "ib_logfile1";
 $size_in_MB = (-s "$dir/$file") / (1024 * 1024);;
 print "The size of the $file file: $size_in_MB \n";
 $file = "ib_logfile2";
 $size_in_MB = (-s "$dir/$file") / (1024 * 1024);;
 print "The size of the $file file: $size_in_MB \n";
 $file = "ib_logfile3";
 $size_in_MB = (-s "$dir/$file") / (1024 * 1024);;
 print "The size of the $file file: $size_in_MB \n";
 $file = "ib_logfile4";
 $size_in_MB = (-s "$dir/$file") / (1024 * 1024);;
 print "The size of the $file file: $size_in_MB \n";
EOF


USE db_wl6494;
SELECT id,LEFT(bfield,20) FROM t1;
--ERROR ER_DUP_ENTRY
INSERT INTO t1 VALUES (1,repeat('a',2000)),(2,repeat('b',2000)),
(3,repeat('c',2000));
INSERT INTO t1 VALUES (21,repeat('a',2000)),(22,repeat('b',2000)),
(23,repeat('c',2000));
SELECT id,LEFT(bfield,20) FROM t1;

# clenaup of test
# restart with different redo log size
DROP TABLE t1;
DROP DATABASE db_wl6494;
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
# Do something while server is down
--error 0,1
--move_file $SEARCH_FILE $MYSQLTEST_VARDIR/log/mysqld.1.err.old1
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
# set log size to 3*3M
--exec echo "restart: --innodb-fast-shutdown=2 --innodb-log-file-size=3M --innodb_log_files_in_group=3" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc

SELECT @@innodb_log_file_size;
SELECT @@innodb_log_files_in_group;

# Testcase 2 - set log file size < existing size and innodb_log_files_in_group < old value
--disable_warnings
DROP DATABASE IF EXISTS db_wl6494;
--enable_warnings
CREATE DATABASE db_wl6494;
USE db_wl6494;

CREATE TABLE t1(id INT PRIMARY KEY,bfield blob) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,repeat('a',2000)),(2,repeat('b',2000)),
(3,repeat('c',2000));
START TRANSACTION;
INSERT INTO t1 VALUES (11,repeat('a',2000)),(12,repeat('b',2000)),
(13,repeat('c',2000));
SAVEPOINT A;
INSERT INTO t1 VALUES (21,repeat('a',2000)),(22,repeat('b',2000)),
(23,repeat('c',2000));
SAVEPOINT B;
SELECT id,LEFT(bfield,20) FROM t1;
ROLLBACK TO A;
COMMIT;
SELECT id,LEFT(bfield,20) FROM t1;

# restart with different redo log size
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
# Do something while server is down
--enable_reconnect
# Write file to make mysql-test-run.pl start up the server again
# set log size from 3*3M to 2*2M
--exec echo "restart: --innodb-log-file-size=2M --innodb_log_files_in_group=2  --log-error=$MYSQLTEST_VARDIR/log/case2.err" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc

SELECT @@innodb_log_file_size;
SELECT @@innodb_log_files_in_group;


let SEARCH_FILE= $MYSQLTEST_VARDIR/log/case2.err;
let SEARCH_PATTERN= InnoDB: Starting crash recovery;
--source include/search_pattern_in_file.inc


USE db_wl6494;
SELECT id,LEFT(bfield,20) FROM t1;
--ERROR ER_DUP_ENTRY
INSERT INTO t1 VALUES (1,repeat('a',2000)),(2,repeat('b',2000)),
(3,repeat('c',2000));
INSERT INTO t1 VALUES (21,repeat('a',2000)),(22,repeat('b',2000)),
(23,repeat('c',2000));
SELECT id,LEFT(bfield,20) FROM t1;

# end of testcase 2. Do not drop table/database as it is used in foloowing case

# testcase misc
let MYSQLD_DATADIR= `select @@datadir`;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/my_restart.err;
let $args=--loose-console > $SEARCH_FILE 2>&1;

# Stop the server
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
--exec echo "wait" > $restart_file
--shutdown_server
--source include/wait_until_disconnected.inc

--echo "test misc 1"
--error 1
--exec $MYSQLD_CMD $args --innodb-log-group-home-dir=foo\;bar
let SEARCH_PATTERN= syntax error in innodb_log_group_home_dir;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo "test misc 2"
--error 1
--exec $MYSQLD_CMD $args --innodb-mirrored-log-groups=2
let SEARCH_PATTERN= innodb_mirrored_log_groups is an unimplemented feature and the variable will be completely removed in a future version. Using values other than 1 is not supported.;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo "test misc 3"
--error 1
--exec $MYSQLD_CMD $args --innodb-read-only
let SEARCH_PATTERN= InnoDB: Cannot resize log files in read-only mode;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE

--echo "test misc 4"
# We should have perfectly synced files here.
# Rename the log files, and trigger an error in recovery.
#--move_file $MYSQLD_DATADIR/ib_logfile101 $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: Only one log file found;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
#--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile101
--move_file $MYSQLD_DATADIR/ib_logfile1_hidden $MYSQLD_DATADIR/ib_logfile1

--echo "test misc 5"
# make copy of ib_logfile0 before editing
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile0_hidden
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile0");
print FILE "garbage";
close(FILE);
EOF
--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: .*ib_logfile0 size 7 is not a multiple of innodb_page_size;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile0
--move_file $MYSQLD_DATADIR/ib_logfile0_hidden $MYSQLD_DATADIR/ib_logfile0


--echo "test misc 6"
--move_file $MYSQLD_DATADIR/ib_logfile1 $MYSQLD_DATADIR/ib_logfile1_hidden
perl;
die unless open(FILE, ">$ENV{MYSQLD_DATADIR}/ib_logfile1");
print FILE "junkfill" x 131072;
close(FILE);
EOF

--error 1
--exec $MYSQLD_CMD $args
let SEARCH_PATTERN= InnoDB: .*ib_logfile1 is of different size;
--source include/search_pattern_in_file.inc
--remove_file $SEARCH_FILE
--remove_file $MYSQLD_DATADIR/ib_logfile1
--move_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile0_hidden

# restart server
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
USE db_wl6494;
SELECT id,LEFT(bfield,20) FROM t1;
--ERROR ER_DUP_ENTRY
INSERT INTO t1 VALUES (1,repeat('a',2000)),(2,repeat('b',2000)),
(3,repeat('c',2000));

# cleanup and set original values
DROP TABLE t1;
DROP DATABASE db_wl6494;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/log/mysqld.1.err.old1
--error 0,1
--remove_file $MYSQLTEST_VARDIR/log/case1.err
--error 0,1
--remove_file $MYSQLTEST_VARDIR/log/case2.err
--remove_file $MYSQLD_DATADIR/ib_logfile0_hidden
--remove_file $MYSQLD_DATADIR/ib_logfile1_hidden
--disable_query_log
eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
--enable_query_log