mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / stress / include / ddl3.inc
blobd41c8506be4672e39e589dd68cb7325f4a7fdd27
1 ######## include/ddl3.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 3 variants (3A - 3D)
7 # The variables
8 #     $loop_size -- number of rounds till we look at the clock again
9 #     $runtime   -- rough intended runtime per subtest variant
10 #     $engine_type -- storage engine to be used in CREATE TABLE
11 # must be set within the routine sourcing this script.
13 # Other stuff which must already exist:
14 # - connection con2
15 # - stmt_start and stmt_break prepared by the default connection
17 # Please look for more details within include/ddl2.inc.
19 # Creation of this test:
20 # 2007-07-04 mleich
24 #----------------------------------------------------------------------
25 # Settings for Subtest 3 variants
26 # Scenario: CREATE TABLE/CREATE TABLE(F)/DROP TABLE/DROP TABLE(F)
27 let $create_table=  CREATE TABLE t1 (f1 BIGINT NOT NULL) ENGINE=$engine_type;
28 let $drop_table=    DROP TABLE t1;
29 #----------------------------------------------------------------------
32 --echo # Subtest 3A (one connection, no PREPARE/EXECUTE)
33 --echo #    connection  action
34 --echo #    default:    $create_table
35 --echo #    default:    $create_table (expect to get ER_TABLE_EXISTS_ERROR)
36 --echo #    default:    $drop_table
37 --echo #    default:    $drop_table (expect to get ER_BAD_TABLE_ERROR)
38 --disable_query_log
39 --disable_result_log
40 connection default;
41 let $run= 1;
42 # Determine the current time.
43 EXECUTE stmt_start;
44 # Run execution loops till the planned runtime is reached
45 while ($run)
47    let $loop_run= $loop_size;
48    while ($loop_run)
49    {
50       eval $create_table;
51       --error 0,ER_TABLE_EXISTS_ERROR
52       eval $create_table;
53       if (!$mysql_errno)
54       {
55          --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
56          --echo # abort
57          exit;
58       }
59       eval $drop_table;
60       --error 0,ER_BAD_TABLE_ERROR
61       eval $drop_table;
62       if (!$mysql_errno)
63       {
64          --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
65          --echo # abort
66          exit;
67       }
68       dec $loop_run;
69    }
70    if (`EXECUTE stmt_break`)
71    {
72       let $run= 0;
73    }
75 --enable_result_log
76 --enable_query_log
78 --echo # Subtest 3B (one connection, use PREPARE/EXECUTE)
79 --echo #    connection  action
80 --echo #    default:    $create_table
81 --echo #    default:    $create_table (expect to get ER_TABLE_EXISTS_ERROR)
82 --echo #    default:    $drop_table
83 --echo #    default:    $drop_table (expect to get ER_BAD_TABLE_ERROR)
84 --disable_query_log
85 --disable_result_log
86 connection default;
87 eval PREPARE create_table FROM "$create_table";
88 EXECUTE create_table;
89 eval PREPARE drop_table FROM "$drop_table";
90 EXECUTE drop_table;
91 let $run= 1;
92 # Determine the current time.
93 EXECUTE stmt_start;
94 # Run execution loops till the planned runtime is reached
95 while ($run)
97    let $loop_run= $loop_size;
98    while ($loop_run)
99    {
100       EXECUTE create_table;
101       --error 0,ER_TABLE_EXISTS_ERROR
102       EXECUTE create_table;
103       if (!$mysql_errno)
104       {
105          --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
106          --echo # abort
107          exit;
108       }
109       EXECUTE drop_table;
110       --error 0,ER_BAD_TABLE_ERROR
111       EXECUTE drop_table;
112       if (!$mysql_errno)
113       {
114          --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
115          --echo # abort
116          exit;
117       }
118       dec $loop_run;
119    }
120    if (`EXECUTE stmt_break`)
121    {
122       let $run= 0;
123    }
125 DEALLOCATE PREPARE create_table;
126 DEALLOCATE PREPARE drop_table;
127 --enable_result_log
128 --enable_query_log
130 --echo # Subtest 3C (two connections, no PREPARE/EXECUTE)
131 --echo #    connection  action
132 --echo #    default:    $create_table
133 --echo #    con2:       $create_table (expect to get ER_TABLE_EXISTS_ERROR)
134 --echo #    default:    $drop_table
135 --echo #    con2:       $drop_table (expect to get ER_BAD_TABLE_ERROR)
136 --disable_query_log
137 --disable_result_log
138 connection default;
139 let $run= 1;
140 # Determine the current time.
141 EXECUTE stmt_start;
142 # Run execution loops till the planned runtime is reached
143 while ($run)
145    let $loop_run= $loop_size;
146    while ($loop_run)
147    {
148       eval $create_table;
149       connection con2;
150       --error 0,ER_TABLE_EXISTS_ERROR
151       eval $create_table;
152       if (!$mysql_errno)
153       {
154          --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
155          --echo # abort
156          exit;
157       }
158       connection default;
159       eval $drop_table;
160       connection con2;
161       --error 0,ER_BAD_TABLE_ERROR
162       eval $drop_table;
163       if (!$mysql_errno)
164       {
165          --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
166          --echo # abort
167          exit;
168       }
169       connection default;
170       dec $loop_run;
171    }
172    if (`EXECUTE stmt_break`)
173    {
174       let $run= 0;
175    }
177 --enable_result_log
178 --enable_query_log
180 --echo # Subtest 3D (two connections, use PREPARE/EXECUTE)
181 --echo #    connection  action
182 --echo #    default:    $create_table
183 --echo #    con2:       $create_table (expect to get ER_TABLE_EXISTS_ERROR)
184 --echo #    default:    $drop_table
185 --echo #    con2:       $drop_table (expect to get ER_BAD_TABLE_ERROR)
186 --disable_query_log
187 --disable_result_log
188 connection default;
189 eval PREPARE create_table FROM "$create_table";
190 eval PREPARE drop_table FROM "$drop_table";
191 EXECUTE create_table;
192 connection con2;
193 eval PREPARE create_table FROM "$create_table";
194 eval PREPARE drop_table FROM "$drop_table";
195 EXECUTE drop_table;
196 connection default;
197 let $run= 1;
198 # Determine the current time.
199 EXECUTE stmt_start;
200 # Run execution loops till the planned runtime is reached
201 while ($run)
203    let $loop_run= $loop_size;
204    while ($loop_run)
205    {
206       EXECUTE create_table;
207       connection con2;
208       --error 0,ER_TABLE_EXISTS_ERROR
209       EXECUTE create_table;
210       if (!$mysql_errno)
211       {
212          --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
213          --echo # abort
214          exit;
215       }
216       connection default;
217       EXECUTE drop_table;
218       connection con2;
219       --error 0,ER_BAD_TABLE_ERROR
220       EXECUTE drop_table;
221       if (!$mysql_errno)
222       {
223          --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
224          --echo # abort
225          exit;
226       }
227       connection default;
228       dec $loop_run;
229    }
230    if (`EXECUTE stmt_break`)
231    {
232       let $run= 0;
233    }
235 DEALLOCATE PREPARE create_table;
236 DEALLOCATE PREPARE drop_table;
237 connection con2;
238 DEALLOCATE PREPARE create_table;
239 DEALLOCATE PREPARE drop_table;
240 connection default;
241 --enable_result_log
242 --enable_query_log