| 1 |
--source include/long_test.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_log_bin.inc |
| 4 |
--source include/default_charset.inc |
| 5 |
|
| 6 |
if (!$BIG_TEST) |
| 7 |
{ |
| 8 |
--source include/not_valgrind.inc |
| 9 |
} |
| 10 |
|
| 11 |
# Starting with 11.7, this will hit the 900-second timeout on WITH_MSAN=ON CMAKE_BUILD_TYPE=Debug |
| 12 |
--source include/not_msan.inc |
| 13 |
|
| 14 |
--source include/test_db_charset_latin1.inc |
| 15 |
|
| 16 |
# |
| 17 |
# Testing of atomic create table with crashes in a lot of different places |
| 18 |
# |
| 19 |
# Things tested: |
| 20 |
# With myisam and InnoDB engines to ensure that cover both normal and |
| 21 |
# online alter table paths. |
| 22 |
# Alter table with new columns |
| 23 |
# Alter table which only touches .frm |
| 24 |
# Alter table disable keys (has it own code path) |
| 25 |
# Alter table with rename |
| 26 |
# Alter table with rename and only options that touches .frm |
| 27 |
# Alter table with rename and add new columns |
| 28 |
# Alter table with storage engine change (with and without column definition |
| 29 |
# changes) |
| 30 |
# Alter table with storage engine change and rename |
| 31 |
# Alter table to another database |
| 32 |
|
| 33 |
--disable_query_log |
| 34 |
call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal"); |
| 35 |
# Speed up wait_until_connected_again.inc |
| 36 |
let NO_WSREP=1; |
| 37 |
--enable_query_log |
| 38 |
let $MYSQLD_DATADIR= `SELECT @@datadir`; |
| 39 |
|
| 40 |
create database test2; |
| 41 |
RESET MASTER; |
| 42 |
|
| 43 |
if ($engine_count == "") |
| 44 |
{ |
| 45 |
let $engine_count=2; |
| 46 |
let $engines='myisam','innodb'; |
| 47 |
} |
| 48 |
if ($extra_engine == "") |
| 49 |
{ |
| 50 |
let $extra_engine=aria; |
| 51 |
} |
| 52 |
|
| 53 |
let $crash_count=13; |
| 54 |
let $crash_points='ddl_log_alter_after_create_frm', 'ddl_log_alter_after_create_table', 'ddl_log_alter_after_prepare_inplace','ddl_log_alter_after_copy', 'ddl_log_alter_after_log', 'ddl_log_alter_after_rename_to_backup', 'ddl_log_alter_after_rename_to_backup_log', 'ddl_log_alter_rename_frm', 'ddl_log_alter_after_rename_to_original', 'ddl_log_alter_before_rename_triggers', 'ddl_log_alter_after_rename_triggers', 'ddl_log_alter_after_delete_backup', 'ddl_log_alter_after_drop_original_table'; |
| 55 |
|
| 56 |
let $statement_count=16; |
| 57 |
if ($skip_vector == "") |
| 58 |
{ |
| 59 |
let $statement_count=21; |
| 60 |
} |
| 61 |
|
| 62 |
let $statements='ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new"', |
| 63 |
'ALTER TABLE t1 COMMENT "new"', |
| 64 |
'ALTER TABLE t1 change column a c int COMMENT "new"', |
| 65 |
'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2', |
| 66 |
'ALTER TABLE t1 disable keys', |
| 67 |
'ALTER TABLE t1 ADD COLUMN c INT, ALGORITHM=copy, COMMENT "new"', |
| 68 |
'ALTER TABLE t1 rename t2', |
| 69 |
'ALTER TABLE t1 COMMENT "new", rename t2', |
| 70 |
'ALTER TABLE t1 change column a c int COMMENT "new", rename t2', |
| 71 |
'ALTER TABLE t1 ENGINE=$extra_engine, COMMENT "new"', |
| 72 |
'ALTER TABLE t1 change column a c int COMMENT "new", engine=$extra_engine', |
| 73 |
'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename t2, engine=$extra_engine', |
| 74 |
'ALTER TABLE t1 ADD COLUMN c INT, COMMENT "new", rename test2.t2', |
| 75 |
'ALTER TABLE t1 COMMENT "new", rename test2.t2', |
| 76 |
'ALTER TABLE t1 ADD key(b), COMMENT "new"', |
| 77 |
'ALTER TABLE t1 DROP INDEX a', |
| 78 |
'ALTER TABLE t1 ADD COLUMN v VECTOR(5) NOT NULL, ADD VECTOR INDEX(v)', |
| 79 |
'ALTER TABLE t1 ADD COLUMN v VECTOR(5) NOT NULL, ADD VECTOR INDEX(v), RENAME t2', |
| 80 |
'ALTER TABLE t1 ADD COLUMN v VECTOR(5) NOT NULL, ADD VECTOR INDEX(v), ENGINE=$extra_engine', |
| 81 |
'ALTER TABLE t1 ADD COLUMN v VECTOR(5) NOT NULL, ADD VECTOR INDEX(v), RENAME t2, ENGINE=$extra_engine', |
| 82 |
'ALTER TABLE t1 ADD COLUMN v VECTOR(5) NOT NULL, ADD VECTOR INDEX(v), RENAME test2.t2'; |
| 83 |
|
| 84 |
# If there is a need of testing one specific state (crash point and query), |
| 85 |
# one can use the comments below to execute one specific test combination |
| 86 |
#let $crash_count=1; |
| 87 |
#let $crash_points='ddl_log_alter_after_create_frm'; |
| 88 |
#let $statement_count= 1; |
| 89 |
#let $statements='ALTER TABLE t1 ADD COLUMN c int, COMMENT "new"'; |
| 90 |
#let $engine_count=1; |
| 91 |
#let $engines='rocksdb'; |
| 92 |
#--source include/have_rocksdb.inc |
| 93 |
|
| 94 |
let $old_debug=`select @@debug_dbug`; |
| 95 |
let $e=0; |
| 96 |
let $keep_include_silent=1; |
| 97 |
let $grep_script=ALTER; |
| 98 |
--disable_query_log |
| 99 |
|
| 100 |
while ($e < $engine_count) |
| 101 |
{ |
| 102 |
inc $e; |
| 103 |
let $engine=`select ELT($e, $engines)`; |
| 104 |
let $default_engine=$engine; |
| 105 |
|
| 106 |
--echo |
| 107 |
--echo engine: $engine |
| 108 |
--echo |
| 109 |
|
| 110 |
let $r=0; |
| 111 |
while ($r < $statement_count) |
| 112 |
{ |
| 113 |
inc $r; |
| 114 |
let $statement=`select ELT($r, $statements)`; |
| 115 |
--echo |
| 116 |
--echo query: $statement |
| 117 |
--echo |
| 118 |
let $c=0; |
| 119 |
while ($c < $crash_count) |
| 120 |
{ |
| 121 |
inc $c; |
| 122 |
let $crash=`select ELT($c, $crash_points)`; |
| 123 |
|
| 124 |
--eval create table t1 (a int, b int, key(a) $extra_fields) engine=$engine |
| 125 |
insert into t1 (a,b) values (1,1),(2,2); |
| 126 |
commit; |
| 127 |
flush tables; |
| 128 |
|
| 129 |
FLUSH BINARY LOGS; |
| 130 |
--let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 131 |
--echo crash point: $crash |
| 132 |
if ($crash_count > 1) |
| 133 |
{ |
| 134 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 135 |
} |
| 136 |
# The following can be used for testing one specific failure |
| 137 |
# if ($crash == "ddl_log_alter_after_log") |
| 138 |
# { |
| 139 |
# if ($r == 2) |
| 140 |
# { |
| 141 |
# --remove_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 142 |
# } |
| 143 |
# } |
| 144 |
--disable_reconnect |
| 145 |
--eval set @@debug_dbug="+d,$crash",@debug_crash_counter=1 |
| 146 |
let $errno=0; |
| 147 |
--error 0,2013 |
| 148 |
--eval $statement; |
| 149 |
let $error=$errno; |
| 150 |
--enable_reconnect |
| 151 |
--source include/wait_until_connected_again.inc |
| 152 |
--disable_query_log |
| 153 |
--eval set @@debug_dbug="$old_debug" |
| 154 |
|
| 155 |
if ($error == 0) |
| 156 |
{ |
| 157 |
echo "No crash!"; |
| 158 |
} |
| 159 |
if ($error != 0) |
| 160 |
{ |
| 161 |
--list_files $MYSQLD_DATADIR/test t* |
| 162 |
--list_files $MYSQLD_DATADIR/test *sql* |
| 163 |
--list_files $MYSQLD_DATADIR/test2 t* |
| 164 |
--list_files $MYSQLD_DATADIR/test2 *sql* |
| 165 |
# Check which tables still exists |
| 166 |
--error 0,1 |
| 167 |
--file_exists $MYSQLD_DATADIR/test/t1.frm |
| 168 |
let $error2=$errno; |
| 169 |
if ($error2 == 0) |
| 170 |
{ |
| 171 |
show create table t1; |
| 172 |
select count(*) from t1; |
| 173 |
} |
| 174 |
if ($error2 == 1) |
| 175 |
{ |
| 176 |
--error 0,1 |
| 177 |
--file_exists $MYSQLD_DATADIR/test/t2.frm |
| 178 |
let $error3=$errno; |
| 179 |
if ($error3 == 0) |
| 180 |
{ |
| 181 |
show create table t2; |
| 182 |
select count(*) from t2; |
| 183 |
} |
| 184 |
if ($error3 == 1) |
| 185 |
{ |
| 186 |
--echo "Table is in test2" |
| 187 |
show create table test2.t2; |
| 188 |
select count(*) from test2.t2; |
| 189 |
} |
| 190 |
} |
| 191 |
--let $binlog_file=$start_binlog_file |
| 192 |
--let $binlog_output_name=master-bin.000001 |
| 193 |
|
| 194 |
--source include/show_binlog_events.inc |
| 195 |
if ($error) |
| 196 |
{ |
| 197 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 198 |
--let $binlog_output_name=master-bin.000002 |
| 199 |
if ($binlog_file != $start_binlog_file) |
| 200 |
{ |
| 201 |
--source include/show_binlog_events.inc |
| 202 |
} |
| 203 |
} |
| 204 |
} |
| 205 |
--disable_warnings |
| 206 |
drop table if exists t1,t2; |
| 207 |
drop table if exists test2.t2; |
| 208 |
--enable_warnings |
| 209 |
} |
| 210 |
} |
| 211 |
} |
| 212 |
drop database test2; |
| 213 |
--enable_query_log |
| 214 |
--source include/test_db_charset_restore.inc |