maria-recovery.result 10.4 KB
Newer Older
unknown's avatar
unknown committed
1
set global maria_log_file_size=4294967295;
2 3 4 5 6 7
drop database if exists mysqltest;
create database mysqltest;
use mysqltest;
* shut down mysqld, removed logs, restarted it
use mysqltest;
create table t1 (a varchar(1000)) engine=maria;
8
* TEST of REDO: see if recovery can reconstruct if we give it an old table
9 10 11 12 13 14 15 16 17 18
* copied t1 for feeding_recovery
insert into t1 values ("00000000");
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
19
check table t1 extended;
20
Table	Op	Msg_type	Msg_text
21
mysqltest.t1	check	status	OK
22
* testing that checksum after recovery is as expected
23
Checksum-check
24
ok
25
* compared t1 to old version
26 27 28 29
use mysqltest;
select * from t1;
a
00000000
30
* TEST of REDO+UNDO: normal recovery test (no moving tables under its feet)
31 32 33 34 35 36 37 38 39 40
insert into t1 values ("00000000");
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values ("aaaaaaaaa");
SET SESSION debug="+d,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
41
check table t1 extended;
42
Table	Op	Msg_type	Msg_text
43
mysqltest.t1	check	status	OK
44
* testing that checksum after recovery is as expected
45
Checksum-check
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
ok
use mysqltest;
select * from t1;
a
00000000
00000000
insert into t1 values ("00000000");
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values ("aaaaaaaaa");
SET SESSION debug="+d,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
62
check table t1 extended;
63
Table	Op	Msg_type	Msg_text
64
mysqltest.t1	check	status	OK
65
* testing that checksum after recovery is as expected
66
Checksum-check
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
ok
use mysqltest;
select * from t1;
a
00000000
00000000
00000000
insert into t1 values ("00000000");
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values ("aaaaaaaaa");
SET SESSION debug="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
84
check table t1 extended;
85
Table	Op	Msg_type	Msg_text
86
mysqltest.t1	check	status	OK
87
* testing that checksum after recovery is as expected
88
Checksum-check
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
ok
use mysqltest;
select * from t1;
a
00000000
00000000
00000000
00000000
insert into t1 values ("00000000");
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values ("aaaaaaaaa");
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
107
check table t1 extended;
108
Table	Op	Msg_type	Msg_text
109
mysqltest.t1	check	status	OK
110
* testing that checksum after recovery is as expected
111
Checksum-check
112 113 114 115 116 117 118 119 120 121
ok
use mysqltest;
select * from t1;
a
00000000
00000000
00000000
00000000
00000000
drop table t1;
unknown's avatar
unknown committed
122
* TEST of two REDOs for same page in one REDO group
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
* shut down mysqld, removed logs, restarted it
use mysqltest;
CREATE TABLE t1 (
i int,
b blob default NULL,
c varchar(6000) default NULL
) ENGINE=MARIA CHECKSUM=1;
* copied t1 for feeding_recovery
INSERT INTO t1 VALUES (1, REPEAT('a', 5000), REPEAT('b', 5000));
UPDATE t1 SET i=3, b=CONCAT(b,'c') WHERE i=1;
SELECT LENGTH(b) FROM t1 WHERE i=3;
LENGTH(b)
5001
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
144
check table t1 extended;
145
Table	Op	Msg_type	Msg_text
146
mysqltest.t1	check	status	OK
147
* testing that checksum after recovery is as expected
148
Checksum-check
149 150 151 152 153 154
ok
use mysqltest;
SELECT LENGTH(b) FROM t1 WHERE i=3;
LENGTH(b)
5001
drop table t1;
unknown's avatar
unknown committed
155
* TEST of INSERT vs state.auto_increment
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
* shut down mysqld, removed logs, restarted it
use mysqltest;
CREATE TABLE t1 (
i int auto_increment primary key,
c varchar(6),
key(c)
) ENGINE=MARIA;
insert into t1 values(null,"b");
* copied t1 for feeding_recovery
insert into t1 values(null,"a"), (null,"c"), (null,"d");
delete from t1 where c="d";
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `i` int(11) NOT NULL AUTO_INCREMENT,
  `c` varchar(6) DEFAULT NULL,
  PRIMARY KEY (`i`),
  KEY `c` (`c`)
189
) ENGINE=MARIA AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
unknown's avatar
unknown committed
190
* TEST of UPDATE vs state.auto_increment
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
* copied t1 for feeding_recovery
update t1 set i=15 where c="a";
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* copied t1 back for feeding_recovery
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show create table t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `i` int(11) NOT NULL AUTO_INCREMENT,
  `c` varchar(6) DEFAULT NULL,
  PRIMARY KEY (`i`),
  KEY `c` (`c`)
215 216
) ENGINE=MARIA AUTO_INCREMENT=16 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
drop table t1;
unknown's avatar
unknown committed
217 218 219
* TEST of removing logs manually
* shut down mysqld, removed logs, restarted it
use mysqltest;
220 221 222 223 224 225 226 227
* TEST of UNDO_ROW_DELETE preserving rowid
create table t1(a int) engine=maria;
insert into t1 values(1),(2);
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values(3);
delete from t1 where a in (1,2,3);
unknown's avatar
unknown committed
228 229 230 231 232 233 234 235 236 237 238
SET SESSION debug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
239
use mysqltest;
unknown's avatar
unknown committed
240 241 242 243 244 245 246 247
drop table t1;
* TEST of checkpoint
set global debug="+d,info,query,enter,exit,loop,maria_checkpoint_indirect";
set global maria_checkpoint_interval=10000;
create table t1(a int, b varchar(10), index(a,b)) engine=maria;
insert into t1 values(1,"a"),(2,"b"),(3,"c");
delete from t1 where b="b";
update t1 set b="d" where a=1;
248 249 250
flush table t1;
* copied t1 for comparison
lock tables t1 write;
unknown's avatar
unknown committed
251 252 253 254 255 256 257 258 259
insert into t1 values(4,"e"),(5,"f"),(6,"g");
update t1 set b="h" where a=5;
delete from t1 where b="g";
show status like "Maria_pagecache_blocks_not_flushed";
Variable_name	Value
Maria_pagecache_blocks_not_flushed	3
set global maria_checkpoint_interval=10000;
update t1 set b="i" where a=5;
SET SESSION debug="+d,maria_crash";
260 261 262 263 264 265 266 267 268 269 270
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
271
drop table t1;
unknown's avatar
unknown committed
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 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
Test of REPAIR's implicit commit
create table t1 (a varchar(100), key(a)) engine=maria;
insert into t1 values(3);
flush table t1;
* copied t1 for comparison
lock tables t1 write;
insert into t1 values (1);
repair table t1;
Table	Op	Msg_type	Msg_text
mysqltest.t1	repair	status	OK
insert into t1 values(2);
select * from t1;
a
1
2
3
SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
failure
use mysqltest;
select * from t1;
a
1
3
drop table t1;
* TEST of recovery when crash before bulk-insert-with-repair is committed
create table t1 (a varchar(100), key(a)) engine=maria;
create table t2 (a varchar(100)) engine=myisam;
set rand_seed1=12, rand_seed2=254;
insert into t2 values (rand());
insert into t2 select (rand()) from t2;
insert into t2 select (rand()) from t2;
insert into t2 select (rand()) from t2;
insert into t2 select (rand()) from t2;
insert into t2 select (rand()) from t2;
insert into t2 select (rand()) from t2;
insert into t1 values(30);
flush table t1;
* copied t1 for comparison
lock tables t1 write, t2 read;
delete from t1 limit 1;
insert into t1 select * from t2;
SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global maria_checkpoint_interval=1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
show keys from t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
t1	1	a	1	a	A	1	NULL	NULL	YES	BTREE	
drop table t1;
* TEST of recovery when OPTIMIZE has replaced the index file and crash
create table t1 (a varchar(100), key(a)) engine=maria;
insert into t1 select (rand()) from t2;
flush table t1;
* copied t1 for comparison
SET SESSION debug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash_sort_index";
* crashing mysqld intentionally
optimize table t1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t1	check	warning	Table is marked as crashed and last repair failed
mysqltest.t1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
use mysqltest;
drop table t1, t2;
357 358 359
drop database mysqltest_for_feeding_recovery;
drop database mysqltest_for_comparison;
drop database mysqltest;