summaryrefslogtreecommitdiff
path: root/mysql-test/suite/maria/maria-recovery2.result
blob: 0ed49ab814201b4724f23c4d221b497c57023c96 (plain)
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
call mtr.add_suppression("File '.*aria_log.000.*' not found \\(Errcode: 2 .*\\)");
call mtr.add_suppression("Table '.\/mysqltest\/t_corrupted1' is crashed, skipping it. Please repair it with aria_chk -r");
set global aria_log_file_size=4294959104;
drop database if exists mysqltest;
create database mysqltest;
connect  admin, 127.0.0.1, root,,mysqltest,,;
connection default;
use mysqltest;
* TEST of removing logs manually
connection default;
connection admin;
* shut down mysqld, removed logs, restarted it
connection default;
* TEST of UNDO_ROW_DELETE preserving rowid
create table t1(a int) engine=aria;
insert into t1 values(1),(2);
connection admin;
flush table t1;
* copied t1 for comparison
connection default;
lock tables t1 write;
insert into t1 values(3);
delete from t1 where a in (1,2,3);
connection admin;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
* crashing mysqld intentionally
set global aria_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
connection default;
use mysqltest;
drop table t1;
* TEST of checkpoint
set global debug_dbug="+d,info,query,enter,exit,loop,maria_checkpoint_indirect";
set global aria_checkpoint_interval=10000;
create table t1(a int, b varchar(10), index(a,b)) engine=aria;
insert into t1 values(1,"a"),(2,"b"),(3,"c");
delete from t1 where b="b";
update t1 set b="d" where a=1;
connection admin;
flush table t1;
* copied t1 for comparison
connection default;
lock tables t1 write;
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 "Aria_pagecache_blocks_not_flushed";
Variable_name	Value
Aria_pagecache_blocks_not_flushed	3
set global aria_checkpoint_interval=10000;
update t1 set b="i" where a=5;
connection admin;
SET SESSION debug_dbug="+d,maria_crash";
* crashing mysqld intentionally
set global aria_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
connection default;
use mysqltest;
drop table t1;
Test of REPAIR's implicit commit
create table t1 (a varchar(100), key(a)) engine=aria;
insert into t1 values(3);
connection admin;
flush table t1;
* copied t1 for comparison
connection default;
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
connection admin;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global aria_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
connection default;
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=aria;
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);
connection admin;
flush table t1;
* copied t1 for comparison
connection default;
lock tables t1 write, t2 read;
delete from t1 limit 1;
select count(*) from t1;
count(*)
0
insert into t1 select * from t2;
connection admin;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash";
* crashing mysqld intentionally
set global aria_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
connection default;
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	Index_comment
t1	1	a	1	a	A	1	NULL	NULL	YES	BTREE		
select count(*) from t1;
count(*)
1
drop table t1;
* TEST of recovery when OPTIMIZE has replaced the index file and crash
create table t_corrupted1 (a varchar(100), key(a)) engine=aria;
insert into t_corrupted1 select (rand()) from t2;
connection admin;
flush table t_corrupted1;
* copied t_corrupted1 for comparison
connection default;
connection admin;
SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_flush_whole_page_cache,maria_crash_sort_index";
* crashing mysqld intentionally
optimize table t_corrupted1;
ERROR HY000: Lost connection to MySQL server during query
* recovery happens
check table t_corrupted1 extended;
Table	Op	Msg_type	Msg_text
mysqltest.t_corrupted1	check	warning	Last repair was aborted before finishing
mysqltest.t_corrupted1	check	status	OK
* testing that checksum after recovery is as expected
Checksum-check
ok
connection default;
use mysqltest;
drop table t_corrupted1, t2;
drop database mysqltest_for_comparison;
drop database mysqltest;