1set global aria_log_file_size=4294959104;
2drop database if exists mysqltest;
3create database mysqltest;
4connect  admin, 127.0.0.1, root,,mysqltest,,;
5connection default;
6use mysqltest;
7connection default;
8connection admin;
9* shut down mysqld, removed logs, restarted it
10connection default;
11* TEST of Checkpoint between writing the commit log record and committing in trnman
12create table t1(a int primary key) engine=aria;
13insert into t1 values(1);
14connection admin;
15flush table t1;
16* copied t1 for comparison
17connection default;
18set session debug_dbug="+d,maria_sleep_in_commit";
19insert into t1 values(2);
20connection admin;
21set global aria_checkpoint_interval=1000;
22connection default;
23delete from t1 where a=2;
24connection admin;
25SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
26* crashing mysqld intentionally
27set global aria_checkpoint_interval=1;
28ERROR HY000: Lost connection to MySQL server during query
29* recovery happens
30check table t1 extended;
31Table	Op	Msg_type	Msg_text
32mysqltest.t1	check	status	OK
33* testing that checksum after recovery is as expected
34Checksum-check
35ok
36connection default;
37use mysqltest;
38drop table t1;
39* TEST of logging of BLOBs
40CREATE TABLE `t1` (
41`blob` blob,
42`blob_key` blob
43) ENGINE=aria ROW_FORMAT=page
44;
45connection admin;
46* copied t1 for feeding_recovery
47* compared t1 to old version
48connection default;
49set global aria_checkpoint_interval=0;
50INSERT INTO `t1` VALUES (NULL,repeat('A',5198));
51INSERT INTO `t1` VALUES (NULL,repeat('B',65535));
52INSERT INTO `t1` VALUES (repeat('K',5198),repeat('L',2325));
53INSERT INTO `t1` VALUES (repeat('C',65535),NULL);
54INSERT INTO `t1` VALUES (NULL,repeat('D',65535));
55INSERT INTO `t1` VALUES (repeat('E',65535),repeat('F',16111));
56INSERT INTO `t1` VALUES (repeat('G',65535),repeat('H',65535));
57INSERT INTO `t1` VALUES (repeat('I',5198),repeat('J',65535));
58check table t1 extended;
59Table	Op	Msg_type	Msg_text
60mysqltest.t1	check	status	OK
61connection admin;
62flush table t1;
63* copied t1 for comparison
64* compared t1 to old version
65connection default;
66connection admin;
67SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash";
68* crashing mysqld intentionally
69set global aria_checkpoint_interval=1;
70ERROR HY000: Lost connection to MySQL server during query
71* copied t1 back for feeding_recovery
72* recovery happens
73check table t1 extended;
74Table	Op	Msg_type	Msg_text
75mysqltest.t1	check	status	OK
76* testing that checksum after recovery is as expected
77Checksum-check
78ok
79* compared t1 to old version
80connection default;
81use mysqltest;
82drop table t1;
83create table t1 engine=aria select 1;
84connection admin;
85* copied t1 for feeding_recovery
86connection default;
87set global aria_checkpoint_interval=0;
88insert into t1 values(2);
89truncate table t1;
90connection admin;
91flush table t1;
92* copied t1 for comparison
93connection default;
94truncate table t1;
95connection admin;
96SET SESSION debug_dbug="+d,maria_flush_whole_log,maria_crash_create_table";
97* crashing mysqld intentionally
98truncate table t1;
99ERROR HY000: Lost connection to MySQL server during query
100* recovery happens
101check table t1 extended;
102Table	Op	Msg_type	Msg_text
103mysqltest.t1	check	warning	Size of indexfile is: <SIZE>       Expected: 8192
104mysqltest.t1	check	status	OK
105* testing that checksum after recovery is as expected
106Checksum-check
107ok
108connection default;
109use mysqltest;
110truncate table t1;
111check table t1 extended;
112Table	Op	Msg_type	Msg_text
113mysqltest.t1	check	status	OK
114drop table t1;
115CREATE TABLE t1 ( word VARCHAR(255) PRIMARY KEY ) ENGINE=Aria;
116LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1;
117SET AUTOCOMMIT=0;
118DELETE FROM t1;
119LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1 IGNORE 1 LINES;
120COMMIT;
121connection admin;
122SET SESSION debug_dbug="+d,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 t1 extended;
128Table	Op	Msg_type	Msg_text
129mysqltest.t1	check	status	OK
130* testing that checksum after recovery is as expected
131Checksum-check
132failure
133connection default;
134use mysqltest;
135select * from t1;
136word
137saved2
138drop table t1;
139drop database mysqltest_for_feeding_recovery;
140drop database mysqltest_for_comparison;
141drop database mysqltest;
142