1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
--source include/have_partition.inc
--source include/have_debug.inc
--source include/have_sequence.inc
--source include/binlog_combinations.inc
--source include/have_binlog_format_row_or_statement.inc
--source include/not_valgrind.inc
let $default_engine=InnoDB;
let $extra_option=;
let $save_debug=`select @@debug_dbug`;
if ($MTR_COMBINATION_MYISAM)
{
let $default_engine=MyISAM;
}
if ($MTR_COMBINATION_ARIA)
{
let $default_engine=Aria;
let $extra_option=transactional=1;
}
if ($MTR_COMBINATION_STMT)
{
let $binlog_format=include/set_binlog_format_statement.sql;
}
if ($MTR_COMBINATION_ROW)
{
let $binlog_format=include/set_binlog_format_row.sql;
}
--disable_query_log
--eval set @@default_storage_engine=$default_engine
--enable_query_log
--echo # Crash recovery
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $crash_count= 14;
let $crash_points='crash_create_before_create_frm',
'crash_alter_partition_after_create_frm',
'crash_alter_partition_after_write_frm',
'crash_convert_partition_1',
'crash_convert_partition_2',
'crash_convert_partition_3',
'crash_convert_partition_4',
'crash_convert_partition_5',
'crash_convert_partition_6',
'crash_convert_partition_7',
'crash_convert_partition_8',
'crash_convert_partition_9',
'crash_convert_partition_10',
'crash_convert_partition_11';
#let $crash_count= 1;
#let $crash_points= 'crash_convert_partition_10';
let $statement_count= 1;
let $statements= 'ALTER TABLE t1 CONVERT PARTITION p1 TO TABLE tp1';
#let $statement_count=1;
#let $statements='CREATE OR REPLACE TABLE t1 SELECT * from const_table';
--delimiter $
create or replace procedure prepare_table()
begin
create or replace table t1 (x int)
with system versioning
partition by range(x) (
partition p0 values less than (10),
partition p1 values less than (20),
partition pn values less than maxvalue);
insert into t1 values (2), (12), (22);
flush tables;
end $
--delimiter ;
let $old_debug=`select @@debug_dbug`;
let $keep_include_silent=1;
let $grep_script=ALTER;
--disable_query_log
let $r=0;
while ($r < $statement_count)
{
inc $r;
let $statement=`select ELT($r, $statements)`;
--echo # QUERY: $statement
let $c=0;
while ($c < $crash_count)
{
inc $c;
let $crash=`select ELT($c, $crash_points)`;
--eval set @@default_storage_engine=$default_engine
call prepare_table;
if (!$c)
{
lock tables t1 write;
}
--source $binlog_format
RESET MASTER;
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--disable_reconnect
--eval set @@debug_dbug="+d,$crash"
let $errno=0;
--error 0,2013
--eval $statement;
let $error=$errno;
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_query_log
--eval set @@debug_dbug="$old_debug"
if ($error == 0)
{
--echo # NO CRASH: $crash
}
if ($error)
{
--echo # CRASH: $crash
}
# Check which tables still exists
--replace_result MAI MYI MAD MYD
--list_files $MYSQLD_DATADIR/test t*
--replace_regex /backup-\d+/backup/
--list_files $MYSQLD_DATADIR/test *sql*
--remove_files_wildcard $MYSQLD_DATADIR/test *sql-backup-*
--let $binlog_file=master-bin.000001
--source include/show_binlog_events.inc
if ($error)
{
--let $binlog_file=master-bin.000002
--source include/show_binlog_events.inc
}
--replace_result $default_engine DEFAULT_ENGINE ' PAGE_CHECKSUM=1' ''
show create table t1;
select * from t1;
--replace_result $default_engine DEFAULT_ENGINE ' PAGE_CHECKSUM=1' ''
--error 0, ER_NO_SUCH_TABLE
show create table tp1;
--error 0, ER_NO_SUCH_TABLE
select * from tp1;
# Drop the tables. The warnings will show what was dropped
--disable_warnings
drop table t1;
drop table if exists tp1;
--enable_warnings
}
}
drop table if exists t1;
drop procedure prepare_table;
--eval set @@debug_dbug="$save_debug"
--enable_query_log
|