Debian Codegraph @

mysql-test/suite/maria/maria-recovery-rtree-ft.test

raw
1 # Test of Recovery of R-tree (table t1) and fulltext (table t2) indices
2
3 --source include/not_embedded.inc
4 # Don't test this under valgrind, memory leaks will occur as we crash
5 --source include/not_valgrind.inc
6 # Binary must be compiled with debug for crash to occur
7 --source include/have_debug.inc
8 --source include/have_maria.inc
9 --source include/long_test.inc
10
11 set global aria_log_file_size=4294959104;
12 let $MARIA_LOG=.;
13
14 --disable_warnings
15 drop database if exists mysqltest;
16 --enable_warnings
17 create database mysqltest;
18 let $mms_tname=t;
19
20 # Include scripts can perform SQL. For it to not influence the main test
21 # they use a separate connection. This way if they use a DDL it would
22 # not autocommit in the main test.
23 connect (admin, localhost, root,,mysqltest,,);
24 --enable_reconnect
25
26 connection default;
27 use mysqltest;
28 --enable_reconnect
29
30 -- source include/maria_empty_logs.inc
31 let $mms_tables=2;
32
33 CREATE TABLE t1 (
34 line POINT NOT NULL,
35 kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
36 name VARCHAR(32)
37 ,SPATIAL key (line)
38 ) transactional=1 row_format=page engine=aria;
39 SHOW INDEX FROM t1;
40 CREATE TABLE t2 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)
41 ) transactional=1 row_format=page engine=aria;
42 SHOW INDEX FROM t2;
43
44 let $query1= INSERT INTO t1 (name, kind, line) VALUES
45 ("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
46 ("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
47 ("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
48 ("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
49 ("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
50 ("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
51 ("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
52 ("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
53 ("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
54 ("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
55 ("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
56 ("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
57 ("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
58 ("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
59 ("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
60 ("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
61 ("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
62 ("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
63 ("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
64 ("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
65 ("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
66 ("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
67 ("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
68 ("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
69 ("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
70 ("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
71 ("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
72 ("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
73 ("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
74
75 let $query2= INSERT INTO t2 VALUES
76 ('MySQL has now support', 'for full-text search'),
77 ('Full-text indexes', 'are called collections'),
78 ('Only MyISAM tables','support collections'),
79 ('Function MATCH ... AGAINST()','is used to do a search'),
80 ('Full-text search in MySQL', 'implements vector space model'),
81 ('We want to see', 'if this is recoverable'),
82 ('Or rather leaves a bad corrupted table', 'after a crash'),
83 ('Test of REDOs', 'and then UNDOs'),
84 ('Recovery is interesting', 'but sometimes complicated'),
85 ('But what if it was simple', 'and boring?'),
86 ('I wish I knew more', 'about how fulltext works'),
87 ('Maybe I should read about it', 'on the Internet');
88
89 --echo * TEST of REDO: see if recovery can reconstruct if we give it an old table
90
91 -- source include/maria_make_snapshot_for_feeding_recovery.inc
92
93 --disable_query_log
94 let $1=120; # 8 is smallest value to cause root split; 12 for child split
95 while($1)
96 {
97 eval $query1;
98 eval $query2;
99 dec $1;
100 }
101 let $1=120;
102 while($1)
103 {
104 delete from t1 limit 1;
105 delete from t1 limit 10;
106 delete from t1 limit 7;
107 delete from t1 limit 2;
108 delete from t2 limit 6;
109 dec $1;
110 }
111 --enable_query_log
112 -- source include/maria_make_snapshot_for_comparison.inc
113 # we want recovery to run on the first snapshot made above
114 let $mvr_restore_old_snapshot=1;
115 let $mms_compare_physically=0;
116 let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
117 let $mvr_crash_statement= set global aria_checkpoint_interval=1;
118 # the script below will trigger recovery and compare checksums
119 -- source include/maria_verify_recovery.inc
120
121 # Test of REDO + UNDO
122 --echo * TEST of INSERT and DELETE's rollback
123
124 # different types of crash => a loop; here are loop control variables
125 let $crash_no_flush=1;
126 let $crash_flush_whole_page_cache=0;
127 let $crash_flush_states=0;
128 let $crash_flush_whole_log=0;
129 let $crash_loop=1;
130
131 # we want recovery to use the tables as they were at time of crash
132 let $mvr_restore_old_snapshot=0;
133 # UNDO phase prevents physical comparison, normally,
134 # so we'll only use checksums to compare.
135 let $mms_compare_physically=0;
136 let $mvr_crash_statement= set global aria_checkpoint_interval=1;
137
138 # Note that we don't remove logs between iterations. Test is
139 # cumulative (each new recovery processes more log records than the previous).
140
141 while ($crash_loop)
142 {
143 if ($crash_flush_whole_log)
144 {
145 let $mvr_debug_option="+d,maria_flush_whole_log,maria_crash";
146 # set up what next iteration should do:
147 let $crash_flush_whole_log=0;
148 let $crash_loop=0;
149 }
150 if ($crash_flush_states)
151 {
152 let $mvr_debug_option="+d,maria_flush_states,maria_flush_whole_log,maria_crash";
153 let $crash_flush_states=0;
154 let $crash_flush_whole_log=1;
155 }
156 if ($crash_flush_whole_page_cache)
157 {
158 let $mvr_debug_option="+d,maria_flush_whole_page_cache,maria_crash";
159 let $crash_flush_whole_page_cache=0;
160 let $crash_flush_states=1;
161 }
162 if ($crash_no_flush)
163 {
164 let $mvr_debug_option="+d,maria_crash";
165 let $crash_no_flush=0;
166 let $crash_flush_whole_page_cache=1;
167 }
168 # Your committed statements here
169 -- source include/maria_make_snapshot_for_comparison.inc
170 # Your statements which we expect to be rolled back
171 lock tables t1 write, t2 write;
172
173 --disable_query_log
174 let $1=120;
175 while($1)
176 {
177 eval $query1;
178 eval $query2;
179 dec $1;
180 }
181 let $1=120;
182 while($1)
183 {
184 delete from t1 limit 1;
185 delete from t1 limit 10;
186 delete from t1 limit 7;
187 delete from t1 limit 2;
188 delete from t2 limit 6;
189 dec $1;
190 }
191 --enable_query_log
192
193 -- source include/maria_verify_recovery.inc
194 }
195
196 # Finally check when we make the table empty
197 # This is currently hitting BUG#36319 so is disabled
198
199 if (0)
200 {
201 -- source include/maria_make_snapshot_for_comparison.inc
202 lock tables t1 write, t2 write;
203 select count(*) from t1;
204 delete from t1;
205 select count(*) from t1;
206 select count(*) from t2;
207 delete from t2;
208 select count(*) from t2;
209 }
210
211 -- source include/maria_verify_recovery.inc
212
213 # clean up everything
214 let $mms_purpose=feeding_recovery;
215 eval drop database mysqltest_for_$mms_purpose;
216 let $mms_purpose=comparison;
217 eval drop database mysqltest_for_$mms_purpose;
218 drop database mysqltest;