Debian Codegraph @

mysql-test/suite/atomic/drop_sequence.test

raw
1 --source include/have_debug.inc
2 --source include/have_log_bin.inc
3 --source include/not_valgrind.inc
4
5 #
6 # Testing of atomic drop with crashes in a lot of different places
7 # We also test having the tables in different databases
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 create database test2;
17
18 let $engine_count=1;
19 let $engines='aria';
20
21 let $crash_count=7;
22 let $crash_points='ddl_log_drop_before_delete_table', 'ddl_log_drop_after_delete_table', 'ddl_log_drop_before_drop_trigger', 'ddl_log_drop_before_drop_trigger2', 'ddl_log_drop_after_drop_trigger', 'ddl_log_drop_before_binlog', 'ddl_log_drop_after_binlog';
23
24 # Number of drops in the tested statement
25 let $drops=3;
26
27 let $old_debug=`select @@debug_dbug`;
28
29 let $e=0;
30 let $keep_include_silent=1;
31 let $grep_script=DROP TABLE;
32 --disable_query_log
33
34 while ($e < $engine_count)
35 {
36 inc $e;
37 let $engine=`select ELT($e, $engines)`;
38 let $default_engine=$engine;
39 let $extra_option=;
40
41 if ($engine == "aria")
42 {
43 let $extra_option=transactional=1;
44 }
45 if ($engine == "aria_notrans")
46 {
47 let $default_engine="aria";
48 let $extra_option=transactional=0;
49 }
50
51 let $c=0;
52 while ($c < $crash_count)
53 {
54 inc $c;
55 let $crash=`select ELT($c, $crash_points)`;
56 let $r=0;
57 while ($r < $drops)
58 {
59 inc $r;
60 --eval set @@default_storage_engine=$default_engine
61 --eval create table t1 (a int not null) $extra_option;
62 --eval create table test2.t2 (b int not null) $extra_option;
63 create sequence ts;
64 insert into t1 values(1);
65 insert into test2.t2 values(2);
66 flush tables;
67
68 delimiter |;
69 create trigger t1_trg before insert on t1 for each row
70 begin
71 if isnull(new.a) then
72 set new.a:= 1000;
73 end if;
74 end|
75 create trigger test2.t2_trg before insert on test2.t2 for each row
76 begin
77 if isnull(new.b) then
78 set new.b:= 2000;
79 end if;
80 end|
81 delimiter ;|
82
83 FLUSH BINARY LOGS;
84 --let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
85
86 echo "engine: $engine crash point: $crash position: $r";
87 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
88 --disable_reconnect
89 --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=$r
90 let $errno=0;
91 --error 0,2013
92 drop table t1,test2.t2,ts;
93 let $error=$errno;
94 --enable_reconnect
95 --source include/wait_until_connected_again.inc
96 --disable_query_log
97 --eval set @@debug_dbug="$old_debug"
98
99 if ($error == 0)
100 {
101 echo "No crash!";
102 }
103 # Check which tables still exists
104 --list_files $MYSQLD_DATADIR/test t*
105 --list_files $MYSQLD_DATADIR/test2 t*
106
107 --let $binlog_file=$start_binlog_file
108 --let $binlog_output_name=master-bin.000001
109 --source include/show_binlog_events.inc
110 if ($error)
111 {
112 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
113 --let $binlog_output_name=master-bin.000002
114 if ($binlog_file != $start_binlog_file)
115 {
116 --source include/show_binlog_events.inc
117 }
118 }
119 # Really drop the tables. The warnings will show what was dropped
120 --disable_warnings
121 drop table if exists t1,test2.t2,ts;
122 --enable_warnings
123 }
124 }
125 }
126 drop table if exists t1,test2.t2,ts;
127 drop database test2;
128 --enable_query_log