1set global aria_log_file_size=4294959104;
2drop database if exists mysqltest;
3create database mysqltest;
4connect  admin, localhost, root,,mysqltest,,;
5connection default;
6use mysqltest;
7connection default;
8connection admin;
9* shut down mysqld, removed logs, restarted it
10connection default;
11CREATE TABLE t1 (
12line POINT NOT NULL,
13kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
14name VARCHAR(32)
15,SPATIAL key (line)
16) transactional=1 row_format=page engine=aria;
17SHOW INDEX FROM t1;
18Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
19t1	1	line	1	line	A	NULL	32	NULL		SPATIAL
20CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
21) transactional=1 row_format=page engine=aria;
22SHOW INDEX FROM t2;
23Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
24t2	1	a	1	a	NULL	NULL	NULL	NULL	YES	FULLTEXT
25t2	1	a	2	b	NULL	NULL	NULL	NULL	YES	FULLTEXT
26* TEST of REDO: see if recovery can reconstruct if we give it an old table
27connection admin;
28* copied t2 for feeding_recovery
29* copied t1 for feeding_recovery
30connection default;
31connection admin;
32flush table t2;
33* copied t2 for comparison
34flush table t1;
35* copied t1 for comparison
36connection default;
37connection admin;
38SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
39* crashing mysqld intentionally
40set global aria_checkpoint_interval=1;
41ERROR HY000: Lost connection to MySQL server during query
42* copied t2 back for feeding_recovery
43* copied t1 back for feeding_recovery
44* recovery happens
45check table t2 extended;
46Table	Op	Msg_type	Msg_text
47mysqltest.t2	check	status	OK
48* testing that checksum after recovery is as expected
49Checksum-check
50ok
51check table t1 extended;
52Table	Op	Msg_type	Msg_text
53mysqltest.t1	check	status	OK
54* testing that checksum after recovery is as expected
55Checksum-check
56ok
57connection default;
58use mysqltest;
59* TEST of INSERT and DELETE's rollback
60connection admin;
61flush table t2;
62* copied t2 for comparison
63flush table t1;
64* copied t1 for comparison
65connection default;
66lock tables t1 write, t2 write;
67connection admin;
68SET SESSION debug_dbug="+d,maria_crash";
69* crashing mysqld intentionally
70set global aria_checkpoint_interval=1;
71ERROR HY000: Lost connection to MySQL server during query
72* recovery happens
73check table t2 extended;
74Table	Op	Msg_type	Msg_text
75mysqltest.t2	check	status	OK
76* testing that checksum after recovery is as expected
77Checksum-check
78ok
79check table t1 extended;
80Table	Op	Msg_type	Msg_text
81mysqltest.t1	check	status	OK
82* testing that checksum after recovery is as expected
83Checksum-check
84ok
85connection default;
86use mysqltest;
87connection admin;
88flush table t2;
89* copied t2 for comparison
90flush table t1;
91* copied t1 for comparison
92connection default;
93lock tables t1 write, t2 write;
94connection admin;
95SET SESSION debug_dbug="+d,maria_flush_whole_page_cache,maria_crash";
96* crashing mysqld intentionally
97set global aria_checkpoint_interval=1;
98ERROR HY000: Lost connection to MySQL server during query
99* recovery happens
100check table t2 extended;
101Table	Op	Msg_type	Msg_text
102mysqltest.t2	check	status	OK
103* testing that checksum after recovery is as expected
104Checksum-check
105ok
106check table t1 extended;
107Table	Op	Msg_type	Msg_text
108mysqltest.t1	check	status	OK
109* testing that checksum after recovery is as expected
110Checksum-check
111ok
112connection default;
113use mysqltest;
114connection admin;
115flush table t2;
116* copied t2 for comparison
117flush table t1;
118* copied t1 for comparison
119connection default;
120lock tables t1 write, t2 write;
121connection admin;
122SET SESSION debug_dbug="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
123* crashing mysqld intentionally
124set global aria_checkpoint_interval=1;
125ERROR HY000: Lost connection to MySQL server during query
126* recovery happens
127check table t2 extended;
128Table	Op	Msg_type	Msg_text
129mysqltest.t2	check	status	OK
130* testing that checksum after recovery is as expected
131Checksum-check
132ok
133check table t1 extended;
134Table	Op	Msg_type	Msg_text
135mysqltest.t1	check	status	OK
136* testing that checksum after recovery is as expected
137Checksum-check
138ok
139connection default;
140use mysqltest;
141connection admin;
142flush table t2;
143* copied t2 for comparison
144flush table t1;
145* copied t1 for comparison
146connection default;
147lock tables t1 write, t2 write;
148connection admin;
149SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
150* crashing mysqld intentionally
151set global aria_checkpoint_interval=1;
152ERROR HY000: Lost connection to MySQL server during query
153* recovery happens
154check table t2 extended;
155Table	Op	Msg_type	Msg_text
156mysqltest.t2	check	status	OK
157* testing that checksum after recovery is as expected
158Checksum-check
159ok
160check table t1 extended;
161Table	Op	Msg_type	Msg_text
162mysqltest.t1	check	status	OK
163* testing that checksum after recovery is as expected
164Checksum-check
165ok
166connection default;
167use mysqltest;
168connection admin;
169SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
170* crashing mysqld intentionally
171set global aria_checkpoint_interval=1;
172ERROR HY000: Lost connection to MySQL server during query
173* recovery happens
174check table t2 extended;
175Table	Op	Msg_type	Msg_text
176mysqltest.t2	check	status	OK
177* testing that checksum after recovery is as expected
178Checksum-check
179ok
180check table t1 extended;
181Table	Op	Msg_type	Msg_text
182mysqltest.t1	check	status	OK
183* testing that checksum after recovery is as expected
184Checksum-check
185ok
186connection default;
187use mysqltest;
188drop database mysqltest_for_feeding_recovery;
189drop database mysqltest_for_comparison;
190drop database mysqltest;
191