Debian Codegraph @

mysql-test/suite/atomic/create_table.test

raw
1 --source include/long_test.inc
2 --source include/have_debug.inc
3 --source include/have_sequence.inc
4 --source include/have_innodb.inc
5 --source include/have_log_bin.inc
6 --source include/not_valgrind.inc
7
8 #
9 # Testing of atomic create table with crashes in a lot of different places
10 #
11 # We test both statement based logging and row logging as CREATE ... SELECT
12 # works a bit differently depending on the logging format
13 # First engine will use row logging and second engine will use statement
14 # based logging
15 #
16
17 --disable_query_log
18 call mtr.add_suppression("InnoDB: .* does not exist in the InnoDB internal");
19 # Speed up wait_until_connected_again.inc
20 let NO_WSREP=1;
21 RESET MASTER;
22 --enable_query_log
23 let $MYSQLD_DATADIR= `SELECT @@datadir`;
24
25 if ($engine_count == "")
26 {
27 let $engine_count=2;
28 let $engines='myisam','innodb';
29 }
30
31 let $crash_count=9;
32 let $crash_points='ddl_log_create_before_create_frm', 'storage_engine_middle_of_create', 'ddl_log_create_before_create_table', 'ddl_log_create_after_create_table', 'ddl_log_create_after_drop', 'ddl_log_create_before_binlog', 'ddl_log_create_after_prepare_eof', 'ddl_log_create_after_binlog', 'ddl_log_create_log_complete';
33
34 let $statement_count=7;
35 let $statements='CREATE TABLE t1 (a int)',
36 'CREATE TABLE t1 (a vector(5) not null, VECTOR INDEX(a))',
37 'CREATE OR REPLACE TABLE t2 (a int)',
38 'CREATE TABLE t1 LIKE const_table',
39 'CREATE OR REPLACE TABLE t2 LIKE const_table',
40 'CREATE TABLE t1 SELECT * from t2',
41 'CREATE OR REPLACE TABLE t2 SELECT * from const_table';
42
43 create table const_table (a int, b int) engine=myisam;
44 insert into const_table values (1,1),(2,2);
45 flush tables;
46
47 let $old_debug=`select @@debug_dbug`;
48
49 let $e=0;
50 let $keep_include_silent=1;
51 let $grep_script=CREATE|DROP;
52 --disable_query_log
53
54 while ($e < $engine_count)
55 {
56 inc $e;
57 let $engine=`select ELT($e, $engines)`;
58 let $default_engine=$engine;
59 let $extra_option=;
60
61 if ($engine == "aria")
62 {
63 let $extra_option=transactional=1;
64 }
65 if ($engine == "aria_notrans")
66 {
67 let $default_engine="aria";
68 let $extra_option=transactional=0;
69 }
70 --echo engine: $engine
71
72 let $r=0;
73 while ($r < $statement_count)
74 {
75 inc $r;
76 let $statement=`select ELT($r, $statements)`;
77 --echo query: $statement
78
79 let $c=0;
80 while ($c < $crash_count)
81 {
82 inc $c;
83 let $crash=`select ELT($c, $crash_points)`;
84
85 --eval set @@default_storage_engine=$default_engine
86 create or replace table t2 select * from seq_1_to_2;
87 flush tables;
88
89 if ($e == 1)
90 {
91 --source include/set_binlog_format_row.sql
92 }
93 if ($e == 2)
94 {
95 --source include/set_binlog_format_statement.sql
96 }
97 FLUSH BINARY LOGS;
98 --let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
99
100 --echo crash point: $crash
101 --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
102 --disable_reconnect
103 --eval set @@debug_dbug="+d,$crash",@debug_crash_counter=1
104 let $errno=0;
105 --error 0,2013
106 --eval $statement;
107 let $error=$errno;
108 --enable_reconnect
109 --source include/wait_until_connected_again.inc
110 --disable_query_log
111 --eval set @@debug_dbug="$old_debug"
112
113 if ($error == 0)
114 {
115 echo "No crash!";
116 }
117 # Check which tables still exists
118 --list_files $MYSQLD_DATADIR/test t*
119 --list_files $MYSQLD_DATADIR/test *sql*
120
121 --let $binlog_file=$start_binlog_file
122 --let $binlog_output_name=master-bin.000001
123 --source include/show_binlog_events.inc
124 if ($error)
125 {
126 --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
127 --let $binlog_output_name=master-bin.000002
128 if ($binlog_file != $start_binlog_file)
129 {
130 --source include/show_binlog_events.inc
131 }
132 }
133 # Drop the tables. The warnings will show what was dropped
134 --disable_warnings
135 drop table if exists t1,t2;
136 --enable_warnings
137 }
138 }
139 }
140 drop table if exists t1,t2,const_table;
141
142 --enable_query_log