Debian Codegraph @

mysql-test/suite/maria/maria-recover.test

raw
1 # Test of the --aria-recover-options option.
2
3 --source include/have_maria.inc
4 --source include/default_charset.inc
5
6 #
7 # Ensure that we don't get warnings from mysql.proc (used by check_mysqld)
8 #
9
10 --disable_query_log
11 --disable_warnings
12 --disable_result_log
13 select count(*) from mysql.proc;
14 --enable_result_log
15 --enable_warnings
16 --enable_query_log
17
18 --disable_query_log
19 # Note: \\. matches a single period. We use '.' as directory separator to
20 # account for Unix and Windows variation.
21 call mtr.add_suppression("Checking table: '\\..mysqltest.t_corrupted2'");
22 call mtr.add_suppression("Recovering table: '\\..mysqltest.t_corrupted2'");
23 call mtr.add_suppression("Table was marked as crashed and should be repaired");
24 call mtr.add_suppression("Read page with wrong checksum");
25
26 let $def_checkinterval=`select @@global.aria_checkpoint_interval`;
27
28 --enable_query_log
29
30 # Note: we're setting an environment variable (not prefixing it by $),
31 # so that the perl code below can access it.
32 let MYSQLD_DATADIR= `select @@datadir`;
33
34 select @@global.aria_recover_options;
35 set global aria_recover_options=off;
36 select @@global.aria_recover_options;
37 set global aria_recover_options=default;
38 select @@global.aria_recover_options;
39 set global aria_recover_options=normal;
40 select @@global.aria_recover_options;
41
42 --disable_warnings
43 drop database if exists mysqltest;
44 --enable_warnings
45 create database mysqltest;
46
47 use mysqltest;
48
49 create table t1 (a varchar(1000), index(a)) engine=aria;
50 insert into t1 values("ThursdayMorningsMarket");
51
52 flush table t1; # put index page on disk
53 insert into t1 select concat(a,'b') from t1 limit 1;
54 # force a checkpoint to get the open count > 0
55 set global aria_checkpoint_interval=1000;
56 # Wait for checkpoint to happen
57 --sleep 1
58 # now t1 has its open_count>0 and so will t2_corrupted.
59 # It is not named t2 because the corruption messages which will be put
60 # in the error log need to be detected in mtr_process.pl, and we want
61 # a specific name to do specific detection (don't want to ignore
62 # any corruption messages of other tests using "t2" as table).
63
64 copy_file $MYSQLD_DATADIR/mysqltest/t1.frm $MYSQLD_DATADIR/mysqltest/t_corrupted2.frm;
65 copy_file $MYSQLD_DATADIR/mysqltest/t1.MAD $MYSQLD_DATADIR/mysqltest/t_corrupted2.MAD;
66 copy_file $MYSQLD_DATADIR/mysqltest/t1.MAI $MYSQLD_DATADIR/mysqltest/t_corrupted2.MAI;
67
68 # Ruin the index file.
69 # If aria-block-size is smaller than the default, the corruption
70 # messages will differ.
71 perl;
72 use strict;
73 use warnings;
74 my $fname= "$ENV{'MYSQLD_DATADIR'}/mysqltest/t_corrupted2.MAI";
75 open(FILE, "+<", $fname) or die;
76 my $whatever= ("\xAB" x 100);
77 sysseek (FILE, 8192, 0) or die;
78 syswrite (FILE, $whatever) or die;
79 close FILE;
80 EOF
81 --replace_result \\ /
82 --replace_regex /for '.*t_corrupted2/for 't_corrupted2/
83 --enable_prepare_warnings
84 select * from t_corrupted2; # should show corruption and repair messages
85 --disable_prepare_warnings
86 select * from t_corrupted2; # should show just rows
87
88 drop database mysqltest;
89 set global aria_recover_options=backup;
90 eval set global aria_checkpoint_interval=$def_checkinterval;