Debian Codegraph @

mysql-test/suite/maria/maria-recovery3.test

raw
1 --source include/not_embedded.inc
2 # Don't test this under valgrind, memory leaks will occur as we crash
3 --source include/not_valgrind.inc
4 # Binary must be compiled with debug for crash to occur
5 --source include/have_debug.inc
6 --source include/have_maria.inc
7
8 set global aria_log_file_size=4294959104;
9 let $MARIA_LOG=../../tmp;
10
11 --disable_warnings
12 drop database if exists mysqltest;
13 --enable_warnings
14 create database mysqltest;
15 let $mms_tname=t;
16
17 # Include scripts can perform SQL. For it to not influence the main test
18 # they use a separate connection. This way if they use a DDL it would
19 # not autocommit in the main test.
20 connect (admin, 127.0.0.1, root,,mysqltest,,);
21 --enable_reconnect
22
23 connection default;
24 use mysqltest;
25 --enable_reconnect
26
27 let $mms_tables=1;
28 let $mvr_restore_old_snapshot=0;
29 let $mms_compare_physically=0;
30 let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
31 let $mvr_crash_statement= set global aria_checkpoint_interval=1;
32
33 -- source include/maria_empty_logs.inc
34
35 # Test for BUG#41037 (recovery failure)
36 --echo * TEST of Checkpoint between writing the commit log record and committing in trnman
37 # we want recovery to use the tables as they were at time of crash
38 let $mvr_restore_old_snapshot=0;
39 # UNDO phase prevents physical comparison, normally,
40 # so we'll only use checksums to compare.
41 let $mms_compare_physically=0;
42 create table t1(a int primary key) engine=aria;
43 insert into t1 values(1);
44 -- source include/maria_make_snapshot_for_comparison.inc
45 set session debug_dbug="+d,maria_sleep_in_commit";
46 send insert into t1 values(2);
47 sleep 1;
48 # Now the INSERT of 2 has written a commit record
49 # but not yet called trnman_commit(), so for checkpoint it's not
50 # committed.
51 connection admin;
52 set global aria_checkpoint_interval=1000; # force a checkpoint
53 connection default;
54 reap; # end of INSERT
55 delete from t1 where a=2;
56 # Bug was that: Recovery starts REDO scanning from too far: from
57 # Checkpoint record which says INSERT is not committed, so
58 # Recovery executes the INSERT's UNDO and finds no key to delete
59 # (as DELETE already deleted it), fails.
60 -- source include/maria_verify_recovery.inc
61 drop table t1;
62
63 # Note that even if machine is loaded and thus INSERT is committed
64 # before checkpoint happens, test should still pass (though it won't
65 # reproduce the conditions of the bug).
66
67 # Test for BUG#41493 Aria: two recovery failures (wrong logging of BLOB pages)
68 --echo * TEST of logging of BLOBs
69 let $mvr_restore_old_snapshot=1;
70 let $mms_compare_physically=1;
71 CREATE TABLE `t1` (
72 `blob` blob,
73 `blob_key` blob
74 ) ENGINE=aria ROW_FORMAT=page
75 ;
76 -- source include/maria_make_snapshot_for_feeding_recovery.inc
77 set global aria_checkpoint_interval=0; # no checkpoints
78 INSERT INTO `t1` VALUES (NULL,repeat('A',5198));
79 INSERT INTO `t1` VALUES (NULL,repeat('B',65535));
80 INSERT INTO `t1` VALUES (repeat('K',5198),repeat('L',2325));
81 INSERT INTO `t1` VALUES (repeat('C',65535),NULL);
82 INSERT INTO `t1` VALUES (NULL,repeat('D',65535));
83 INSERT INTO `t1` VALUES (repeat('E',65535),repeat('F',16111));
84 INSERT INTO `t1` VALUES (repeat('G',65535),repeat('H',65535));
85 INSERT INTO `t1` VALUES (repeat('I',5198),repeat('J',65535));
86 check table t1 extended;
87 -- source include/maria_make_snapshot_for_comparison.inc
88 -- source include/maria_verify_recovery.inc
89 drop table t1;
90
91 # Test for BUG#42112 "Aria: recovery failure (pushbuild2) Assertion
92 # `rownr == 0 && new_page' failed"
93
94 let $mvr_restore_old_snapshot=0;
95 let $mms_compare_physically=0;
96 create table t1 engine=aria select 1;
97 -- source include/maria_make_snapshot_for_feeding_recovery.inc
98 set global aria_checkpoint_interval=0; # no checkpoints
99 insert into t1 values(2);
100 truncate table t1;
101 -- source include/maria_make_snapshot_for_comparison.inc
102 let $mvr_crash_statement= truncate table t1;
103 let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash_create_table";
104 truncate table t1;
105 -- source include/maria_verify_recovery.inc
106 # Table is bad but at least Recovery didn't crash and a new truncate
107 # can succeed:
108 truncate table t1;
109 check table t1 extended;
110 drop table t1;
111
112 #
113 # Test for BUG#887051; Failure in recovery with delete
114 #
115
116 let $mvr_restore_old_snapshot=0;
117 let $mms_compare_physically=0;
118 let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
119 let $mvr_crash_statement= set global aria_checkpoint_interval=1;
120 CREATE TABLE t1 ( word VARCHAR(255) PRIMARY KEY ) ENGINE=Aria;
121 LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1;
122 SET AUTOCOMMIT=0;
123 DELETE FROM t1;
124 LOAD DATA INFILE '../../std_data/bug887051.txt' INTO TABLE t1 IGNORE 1 LINES;
125 COMMIT;
126 -- source include/maria_verify_recovery.inc
127 select * from t1;
128 drop table t1;
129
130 # clean up everything
131 let $mms_purpose=feeding_recovery;
132 eval drop database mysqltest_for_$mms_purpose;
133 let $mms_purpose=comparison;
134 eval drop database mysqltest_for_$mms_purpose;
135 drop database mysqltest;