| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_innodb.inc |
| 3 |
--source include/have_log_bin.inc |
| 4 |
--source include/not_valgrind.inc |
| 5 |
|
| 6 |
# |
| 7 |
# Testing of atomic DROP DATABASE with crashes in a lot of different places |
| 8 |
# |
| 9 |
|
| 10 |
call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal"); |
| 11 |
# Speed up wait_until_connected_again.inc |
| 12 |
let NO_WSREP=1; |
| 13 |
RESET MASTER; |
| 14 |
let $MYSQLD_DATADIR= `SELECT @@datadir`; |
| 15 |
|
| 16 |
let $engine_count=2; |
| 17 |
let $engines='aria','innodb'; |
| 18 |
|
| 19 |
let $crash_count=10; |
| 20 |
let $crash_points='ddl_log_drop_before_delete_table','ddl_log_drop_after_drop_tables','ddl_log_drop_before_ha_drop_database','ddl_log_drop_before_drop_db_routines','ddl_log_drop_after_drop_db_routines','ddl_log_drop_before_drop_option_file','ddl_log_drop_before_drop_dir','ddl_log_drop_after_drop_dir','ddl_log_drop_before_binlog','ddl_log_drop_after_binlog'; |
| 21 |
|
| 22 |
let $old_debug=`select @@debug_dbug`; |
| 23 |
|
| 24 |
let $e=0; |
| 25 |
let $keep_include_silent=1; |
| 26 |
let $grep_script=DROP; |
| 27 |
--disable_query_log |
| 28 |
|
| 29 |
while ($e < $engine_count) |
| 30 |
{ |
| 31 |
inc $e; |
| 32 |
let $engine=`select ELT($e, $engines)`; |
| 33 |
let $default_engine=$engine; |
| 34 |
let $extra_option=; |
| 35 |
|
| 36 |
if ($engine == "aria") |
| 37 |
{ |
| 38 |
let $extra_option=transactional=1; |
| 39 |
} |
| 40 |
if ($engine == "aria_notrans") |
| 41 |
{ |
| 42 |
let $default_engine="aria"; |
| 43 |
let $extra_option=transactional=0; |
| 44 |
} |
| 45 |
|
| 46 |
# Number of tables that should be dropped (we try to crash after each drop) |
| 47 |
let $drops=3; |
| 48 |
|
| 49 |
let $c=0; |
| 50 |
while ($c < $crash_count) |
| 51 |
{ |
| 52 |
inc $c; |
| 53 |
let $crash=`select ELT($c, $crash_points)`; |
| 54 |
let $r=0; |
| 55 |
while ($r < $drops) |
| 56 |
{ |
| 57 |
inc $r; |
| 58 |
create database test2; |
| 59 |
use test2; |
| 60 |
--eval set @@default_storage_engine=$default_engine; |
| 61 |
--eval create table t1 (a int not null) $extra_option; |
| 62 |
create view t1v as select * from t1; |
| 63 |
--eval create table t2 (b int not null) $extra_option; |
| 64 |
create procedure foo() |
| 65 |
insert into test.t1 values (42); |
| 66 |
|
| 67 |
flush tables; |
| 68 |
use test; |
| 69 |
|
| 70 |
FLUSH BINARY LOGS; |
| 71 |
--let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 72 |
|
| 73 |
echo "engine: $engine crash point: $crash position: $r"; |
| 74 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 75 |
--disable_reconnect |
| 76 |
--eval set @@debug_dbug="+d,$crash",@debug_crash_counter=$r |
| 77 |
let $errno=0; |
| 78 |
--error 0,2013 |
| 79 |
DROP DATABASE test2; |
| 80 |
let $error=$errno; |
| 81 |
--enable_reconnect |
| 82 |
--source include/wait_until_connected_again.inc |
| 83 |
--disable_query_log |
| 84 |
--eval set @@debug_dbug="$old_debug" |
| 85 |
|
| 86 |
if ($error == 0) |
| 87 |
{ |
| 88 |
echo "No crash!"; |
| 89 |
} |
| 90 |
use test; |
| 91 |
# Check which tables still exists |
| 92 |
--error 0,1 |
| 93 |
--list_files $MYSQLD_DATADIR/test2 t* |
| 94 |
--error 0,ER_SP_DOES_NOT_EXIST |
| 95 |
show create procedure test2.foo; |
| 96 |
|
| 97 |
--let $binlog_file=$start_binlog_file |
| 98 |
--let $binlog_output_name=master-bin.000001 |
| 99 |
--source include/show_binlog_events.inc |
| 100 |
if ($error) |
| 101 |
{ |
| 102 |
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 103 |
--let $binlog_output_name=master-bin.000002 |
| 104 |
if ($binlog_file != $start_binlog_file) |
| 105 |
{ |
| 106 |
--source include/show_binlog_events.inc |
| 107 |
} |
| 108 |
} |
| 109 |
# Really drop the tables. The warnings will show what was dropped |
| 110 |
--disable_warnings |
| 111 |
--error 0, ER_DB_DROP_EXISTS |
| 112 |
DROP DATABASE test2; |
| 113 |
--enable_warnings |
| 114 |
} |
| 115 |
# We only need to test drops for all tables for the first crash point |
| 116 |
let $drops=1; |
| 117 |
} |
| 118 |
} |
| 119 |
drop database if exists test2; |
| 120 |
|
| 121 |
--enable_query_log |