Debian Codegraph @

mysql-test/suite/innodb/t/dblwr_encrypt_rowcomp.test

raw
1 --source include/have_debug.inc
2 --source include/have_innodb_16k.inc
3 --source include/not_valgrind.inc
4
5 create table t1 (f1 int, f2 blob) ENCRYPTION='Y';
6
7 START TRANSACTION;
8 INSERT INTO t1 VALUES(1, repeat('#',12));
9 INSERT INTO t1 VALUES(2, repeat('+',12));
10 INSERT INTO t1 VALUES(3, repeat('/',12));
11 INSERT INTO t1 VALUES(4, repeat('-',12));
12 INSERT INTO t1 VALUES(5, repeat('.',12));
13 COMMIT WORK;
14
15 --echo # Wait for purge to complete
16 --source include/wait_innodb_all_purged.inc
17
18 --echo # Ensure that dirty pages of table t1 is flushed.
19 FLUSH TABLES t1 FOR EXPORT;
20 UNLOCK TABLES;
21
22 SET GLOBAL innodb_master_thread_disabled_debug=1;
23 SET GLOBAL innodb_checkpoint_disabled = 1;
24
25 BEGIN;
26 INSERT INTO t1 VALUES (6, repeat('%', 12));
27
28 SET SESSION innodb_interpreter = 'init';
29 SET SESSION innodb_interpreter = 'open_table test/t1';
30
31 --echo # Identify the space_id of the given table.
32 SET SESSION innodb_interpreter = 'find_space_id test/t1';
33 SELECT @@session.innodb_interpreter_output INTO @space_id;
34
35 --echo # Find the root page number of the given table.
36 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
37 SELECT @@session.innodb_interpreter_output INTO @page_no;
38
39 --echo # Find the on-disk page type of the given page.
40 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
41 SET SESSION innodb_interpreter = @cmd;
42 SELECT @@session.innodb_interpreter_output INTO @page_type;
43 SELECT @page_type;
44
45 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
46 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
47
48 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
49 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
50
51 SET SESSION innodb_interpreter = 'destroy';
52
53 let MYSQLD_DATADIR=`SELECT @@datadir`;
54 let PAGE_NO=`select @page_no`;
55 let FILE_NAME=`select @space_file_name`;
56 let PAGE_SIZE=`select @space_page_size`;
57
58 --source include/kill_mysqld.inc
59
60 --echo # Corrupt the root page of table t1 in the user tablespace.
61 perl;
62 use IO::Handle;
63 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
64 my $page_size = $ENV{'PAGE_SIZE'};
65 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
66 open(FILE, "+<", $fname) or die;
67 FILE->autoflush(1);
68 binmode FILE;
69 seek(FILE, $nbytes, SEEK_SET);
70 print FILE chr(0) x 38;
71 close FILE;
72 EOF
73
74 --source include/start_mysqld.inc
75
76 SET SESSION innodb_interpreter = 'init';
77 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
78 SET SESSION innodb_interpreter = 'destroy';
79
80 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
81 let SEARCH_PATTERN= Double write file has encrypted pages;
82 --source include/search_pattern.inc
83
84 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
85 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
86 --source include/search_pattern.inc
87
88 CHECK TABLE t1;
89 SELECT f1, f2 FROM t1;
90
91 ###
92 ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
93 --echo # Ensure that dirty pages of table t1 is flushed.
94 FLUSH TABLES t1 FOR EXPORT;
95 UNLOCK TABLES;
96
97 SET GLOBAL innodb_master_thread_disabled_debug=1;
98 SET GLOBAL innodb_checkpoint_disabled = 1;
99
100 BEGIN;
101 INSERT INTO t1 VALUES (6, repeat('%', 12));
102
103 SET SESSION innodb_interpreter = 'init';
104 SET SESSION innodb_interpreter = 'open_table test/t1';
105
106 --echo # Identify the space_id of the given table.
107 SET SESSION innodb_interpreter = 'find_space_id test/t1';
108 SELECT @@session.innodb_interpreter_output INTO @space_id;
109
110 --echo # Find the root page number of the given table.
111 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
112 SELECT @@session.innodb_interpreter_output INTO @page_no;
113
114 --echo # Find the on-disk page type of the given page.
115 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
116 SET SESSION innodb_interpreter = @cmd;
117 SELECT @@session.innodb_interpreter_output INTO @page_type;
118 SELECT @page_type;
119
120 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
121 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
122
123 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
124 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
125
126 SET SESSION innodb_interpreter = 'destroy';
127
128 let MYSQLD_DATADIR=`SELECT @@datadir`;
129 let PAGE_NO=`select @page_no`;
130 let FILE_NAME=`select @space_file_name`;
131 let PAGE_SIZE=`select @space_page_size`;
132
133 --source include/kill_mysqld.inc
134
135 --echo # Corrupt the root page of table t1 in the user tablespace.
136 perl;
137 use IO::Handle;
138 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
139 my $page_size = $ENV{'PAGE_SIZE'};
140 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
141 open(FILE, "+<", $fname) or die;
142 FILE->autoflush(1);
143 binmode FILE;
144 seek(FILE, $nbytes, SEEK_SET);
145 print FILE chr(0) x 38;
146 close FILE;
147 EOF
148
149 --source include/start_mysqld.inc
150
151 SET SESSION innodb_interpreter = 'init';
152 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
153 SET SESSION innodb_interpreter = 'destroy';
154
155 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
156 let SEARCH_PATTERN= Double write file has encrypted pages;
157 --source include/search_pattern.inc
158
159 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
160 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
161 --source include/search_pattern.inc
162
163 ###
164
165 ###
166 ALTER TABLE t1 ROW_FORMAT=COMPACT;
167 --echo # Ensure that dirty pages of table t1 is flushed.
168 FLUSH TABLES t1 FOR EXPORT;
169 UNLOCK TABLES;
170
171 SET GLOBAL innodb_master_thread_disabled_debug=1;
172 SET GLOBAL innodb_checkpoint_disabled = 1;
173
174 BEGIN;
175 INSERT INTO t1 VALUES (6, repeat('%', 12));
176
177 SET SESSION innodb_interpreter = 'init';
178 SET SESSION innodb_interpreter = 'open_table test/t1';
179
180 --echo # Identify the space_id of the given table.
181 SET SESSION innodb_interpreter = 'find_space_id test/t1';
182 SELECT @@session.innodb_interpreter_output INTO @space_id;
183
184 --echo # Find the root page number of the given table.
185 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
186 SELECT @@session.innodb_interpreter_output INTO @page_no;
187
188 --echo # Find the on-disk page type of the given page.
189 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
190 SET SESSION innodb_interpreter = @cmd;
191 SELECT @@session.innodb_interpreter_output INTO @page_type;
192 SELECT @page_type;
193
194 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
195 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
196
197 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
198 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
199
200 SET SESSION innodb_interpreter = 'destroy';
201
202 let MYSQLD_DATADIR=`SELECT @@datadir`;
203 let PAGE_NO=`select @page_no`;
204 let FILE_NAME=`select @space_file_name`;
205 let PAGE_SIZE=`select @space_page_size`;
206
207 --source include/kill_mysqld.inc
208
209 --echo # Corrupt the root page of table t1 in the user tablespace.
210 perl;
211 use IO::Handle;
212 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
213 my $page_size = $ENV{'PAGE_SIZE'};
214 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
215 open(FILE, "+<", $fname) or die;
216 FILE->autoflush(1);
217 binmode FILE;
218 seek(FILE, $nbytes, SEEK_SET);
219 print FILE chr(0) x 38;
220 close FILE;
221 EOF
222
223 --source include/start_mysqld.inc
224
225 SET SESSION innodb_interpreter = 'init';
226 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
227 SET SESSION innodb_interpreter = 'destroy';
228
229 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
230 let SEARCH_PATTERN= Double write file has encrypted pages;
231 --source include/search_pattern.inc
232
233 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
234 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
235 --source include/search_pattern.inc
236
237 ###
238
239
240 ###
241 ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
242 --echo # Ensure that dirty pages of table t1 is flushed.
243 FLUSH TABLES t1 FOR EXPORT;
244 UNLOCK TABLES;
245
246 SET GLOBAL innodb_master_thread_disabled_debug=1;
247 SET GLOBAL innodb_checkpoint_disabled = 1;
248
249 BEGIN;
250 INSERT INTO t1 VALUES (6, repeat('%', 12));
251
252 SET SESSION innodb_interpreter = 'init';
253 SET SESSION innodb_interpreter = 'open_table test/t1';
254
255 --echo # Identify the space_id of the given table.
256 SET SESSION innodb_interpreter = 'find_space_id test/t1';
257 SELECT @@session.innodb_interpreter_output INTO @space_id;
258
259 --echo # Find the root page number of the given table.
260 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
261 SELECT @@session.innodb_interpreter_output INTO @page_no;
262
263 --echo # Find the on-disk page type of the given page.
264 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
265 SET SESSION innodb_interpreter = @cmd;
266 SELECT @@session.innodb_interpreter_output INTO @page_type;
267 SELECT @page_type;
268
269 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
270 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
271
272 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
273 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
274
275 SET SESSION innodb_interpreter = 'destroy';
276
277 let MYSQLD_DATADIR=`SELECT @@datadir`;
278 let PAGE_NO=`select @page_no`;
279 let FILE_NAME=`select @space_file_name`;
280 let PAGE_SIZE=`select @space_page_size`;
281
282 --source include/kill_mysqld.inc
283
284 --echo # Corrupt the root page of table t1 in the user tablespace.
285 perl;
286 use IO::Handle;
287 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
288 my $page_size = $ENV{'PAGE_SIZE'};
289 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
290 open(FILE, "+<", $fname) or die;
291 FILE->autoflush(1);
292 binmode FILE;
293 seek(FILE, $nbytes, SEEK_SET);
294 print FILE chr(0) x 38;
295 close FILE;
296 EOF
297
298 --source include/start_mysqld.inc
299
300 SET SESSION innodb_interpreter = 'init';
301 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
302 SET SESSION innodb_interpreter = 'destroy';
303
304 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
305 let SEARCH_PATTERN= Double write file has encrypted pages;
306 --source include/search_pattern.inc
307
308 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
309 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
310 --source include/search_pattern.inc
311
312 ###
313
314
315 ###
316 ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
317 --echo # Ensure that dirty pages of table t1 is flushed.
318 FLUSH TABLES t1 FOR EXPORT;
319 UNLOCK TABLES;
320
321 SET GLOBAL innodb_master_thread_disabled_debug=1;
322 SET GLOBAL innodb_checkpoint_disabled = 1;
323
324 BEGIN;
325 INSERT INTO t1 VALUES (6, repeat('%', 12));
326
327 SET SESSION innodb_interpreter = 'init';
328 SET SESSION innodb_interpreter = 'open_table test/t1';
329
330 --echo # Identify the space_id of the given table.
331 SET SESSION innodb_interpreter = 'find_space_id test/t1';
332 SELECT @@session.innodb_interpreter_output INTO @space_id;
333
334 --echo # Find the root page number of the given table.
335 SET SESSION innodb_interpreter = 'find_root_page_no test/t1';
336 SELECT @@session.innodb_interpreter_output INTO @page_no;
337
338 --echo # Find the on-disk page type of the given page.
339 SET @cmd = CONCAT('find_ondisk_page_type ', @space_id, ' ', @page_no);
340 SET SESSION innodb_interpreter = @cmd;
341 SELECT @@session.innodb_interpreter_output INTO @page_type;
342 SELECT @page_type;
343
344 SET SESSION innodb_interpreter = 'find_tablespace_file_name test/t1';
345 SELECT @@session.innodb_interpreter_output INTO @space_file_name;
346
347 SET SESSION innodb_interpreter = 'find_tablespace_physical_page_size test/t1';
348 SELECT @@session.innodb_interpreter_output INTO @space_page_size;
349
350 SET SESSION innodb_interpreter = 'destroy';
351
352 let MYSQLD_DATADIR=`SELECT @@datadir`;
353 let PAGE_NO=`select @page_no`;
354 let FILE_NAME=`select @space_file_name`;
355 let PAGE_SIZE=`select @space_page_size`;
356
357 --source include/kill_mysqld.inc
358
359 --echo # Corrupt the root page of table t1 in the user tablespace.
360 perl;
361 use IO::Handle;
362 my $fname= "$ENV{'MYSQLD_DATADIR'}/$ENV{'FILE_NAME'}";
363 my $page_size = $ENV{'PAGE_SIZE'};
364 my $nbytes = $ENV{'PAGE_NO'} * $ENV{'PAGE_SIZE'};
365 open(FILE, "+<", $fname) or die;
366 FILE->autoflush(1);
367 binmode FILE;
368 seek(FILE, $nbytes, SEEK_SET);
369 print FILE chr(0) x 38;
370 close FILE;
371 EOF
372
373 --source include/start_mysqld.inc
374
375 SET SESSION innodb_interpreter = 'init';
376 SET SESSION innodb_interpreter = 'print_dblwr_has_encrypted_pages';
377 SET SESSION innodb_interpreter = 'destroy';
378
379 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
380 let SEARCH_PATTERN= Double write file has encrypted pages;
381 --source include/search_pattern.inc
382
383 let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
384 let SEARCH_PATTERN= \\[Note\\] \\[MY-\\d+\\] \\[InnoDB\\] Recovered page \\[page id: space=\\d+, page number=\\d+\\] from the doublewrite buffer;
385 --source include/search_pattern.inc
386
387 CHECK TABLE t1;
388 SELECT f1, f2 FROM t1;
389 ###
390
391 DROP TABLE t1;
392 --echo # Test End