1 ######## include/ddl4.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 4 variants (4A - 4D)
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:
15 # - stmt_start and stmt_break prepared by the default connection
17 # Please look for more details within include/ddl1.inc.
19 # Creation of this test:
24 #----------------------------------------------------------------------
25 # Settings for Subtest 4 variants
26 # Scenario: CREATE TABLE variant1/SHOW/DROP TABLE/SHOW(F)/
27 # CREATE TABLE variant2/SHOW/DROP TABLE
28 let $create_table1= CREATE
TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1), UNIQUE (f2)) ENGINE=$engine_type;
29 let $create_table2= CREATE
TABLE t1 (f1 BIGINT) ENGINE=$engine_type;
30 let $show_table= SHOW CREATE
TABLE t1;
31 let $drop_table= DROP
TABLE t1;
34 let $cr_value1= INITIALIZED;
35 let $cr_value1= query_get_value($show_table, Create Table, 1);
38 let $cr_value2= INITIALIZED;
39 let $cr_value2= query_get_value($show_table, Create Table, 1);
41 if (`SELECT
'$cr_value1' =
'$cr_value2'`)
43 --echo # Error during generation of prerequisites.
44 --echo # cr_value1 equals cr_value2
45 --echo # cr_value1: $cr_value1
46 --echo # cr_value2: $cr_value2
50 #----------------------------------------------------------------------
53 --echo # Subtest 4
A (one connection, no PREPARE/EXECUTE)
54 --echo # connection action
55 --echo #
default: $create_table1
56 --echo #
default: $show_table
57 --echo #
default: $drop_table
58 --echo #
default: $show_table (expect
to get ER_NO_SUCH_TABLE)
59 --echo #
default: $create_table2
60 --echo #
default: $show_table
61 --echo #
default: $drop_table
66 # Determine the current time.
68 # Run execution loops till the planned runtime is reached
71 let $loop_run= $loop_size;
75 let $value= INITIALIZED;
76 let $value= query_get_value($show_table, Create Table, 1);
77 if (`SELECT
'$value' <>
'$cr_value1'`)
79 --echo # Error: Unexpected SHOW CREATE
TABLE output
81 --echo # Expected: $cr_value1
86 --error 0,ER_NO_SUCH_TABLE
90 --echo # Error: SHOW CREATE
TABLE was successful though we expected ER_NO_SUCH_TABLE)
95 let $value= INITIALIZED;
96 let $value= query_get_value($show_table, Create Table, 1);
97 if (`SELECT
'$value' <>
'$cr_value2'`)
99 --echo # Error: Unexpected SHOW CREATE
TABLE output
101 --echo # Expected: $cr_value2
108 if (`EXECUTE stmt_break`)
116 --echo # Subtest 4B (one connection, use PREPARE/EXECUTE)
117 --echo # connection action
118 --echo #
default: $create_table1
119 --echo #
default: $show_table
120 --echo #
default: $drop_table
121 --echo #
default: $show_table (expect
to get ER_NO_SUCH_TABLE)
122 --echo #
default: $create_table2
123 --echo #
default: $show_table
124 --echo #
default: $drop_table
128 eval PREPARE create_table1 FROM
"$create_table1";
129 eval PREPARE create_table2 FROM
"$create_table2";
130 EXECUTE create_table1;
131 eval PREPARE show_table FROM
"$show_table";
132 eval PREPARE drop_table FROM
"$drop_table";
135 # Determine the current time.
137 # Run execution loops till the planned runtime is reached
140 let $loop_run= $loop_size;
143 EXECUTE create_table1;
144 let $value= INITIALIZED;
145 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
146 if (`SELECT
'$value' <>
'$cr_value1'`)
148 --echo # Error: Unexpected SHOW CREATE
TABLE output
150 --echo # Expected: $cr_value1
155 --error 0,ER_NO_SUCH_TABLE
159 --echo # Error: SHOW CREATE
TABLE was successful though we expected ER_NO_SUCH_TABLE)
163 EXECUTE create_table2;
164 let $value= INITIALIZED;
165 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
166 if (`SELECT
'$value' <>
'$cr_value2'`)
168 --echo # Error: Unexpected SHOW CREATE
TABLE output
170 --echo # Expected: $cr_value2
177 if (`EXECUTE stmt_break`)
182 DEALLOCATE PREPARE create_table1;
183 DEALLOCATE PREPARE create_table2;
184 DEALLOCATE PREPARE show_table;
185 DEALLOCATE PREPARE drop_table;
189 --echo # Subtest 4C (two connections, no PREPARE/EXECUTE)
190 --echo # connection action
191 --echo #
default: $create_table1
192 --echo # con2: $show_table
193 --echo #
default: $drop_table
194 --echo # con2: $show_table (expect
to get ER_NO_SUCH_TABLE)
195 --echo #
default: $create_table2
196 --echo # con2: $show_table
197 --echo #
default: $drop_table
202 # Determine the current time.
204 # Run execution loops till the planned runtime is reached
207 let $loop_run= $loop_size;
212 let $value= INITIALIZED;
213 let $value= query_get_value($show_table, Create Table, 1);
214 if (`SELECT
'$value' <>
'$cr_value1'`)
216 --echo # Error: Unexpected SHOW CREATE
TABLE output
218 --echo # Expected: $cr_value1
225 --error 0,ER_NO_SUCH_TABLE
229 --echo # Error: SHOW CREATE
TABLE was successful though we expected ER_NO_SUCH_TABLE)
236 let $value= INITIALIZED;
237 let $value= query_get_value($show_table, Create Table, 1);
238 if (`SELECT
'$value' <>
'$cr_value2'`)
240 --echo # Error: Unexpected SHOW CREATE
TABLE output
242 --echo # Expected: $cr_value2
250 if (`EXECUTE stmt_break`)
258 --echo # Subtest 4D (two connections, use PREPARE/EXECUTE)
259 --echo # connection action
260 --echo #
default: $create_table1
261 --echo # con2: $show_table
262 --echo #
default: $drop_table
263 --echo # con2: $show_table (expect
to get ER_NO_SUCH_TABLE)
264 --echo #
default: $create_table2
265 --echo # con2: $show_table
266 --echo #
default: $drop_table
270 eval PREPARE create_table1 FROM
"$create_table1";
271 eval PREPARE create_table2 FROM
"$create_table2";
272 eval PREPARE drop_table FROM
"$drop_table";
273 EXECUTE create_table1;
275 eval PREPARE show_table FROM
"$show_table";
279 # Determine the current time.
281 # Run execution loops till the planned runtime is reached
284 let $loop_run= $loop_size;
287 EXECUTE create_table1;
289 let $value= INITIALIZED;
290 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
291 if (`SELECT
'$value' <>
'$cr_value1'`)
293 --echo # Error: Unexpected SHOW CREATE
TABLE output
295 --echo # Expected: $cr_value1
302 --error 0,ER_NO_SUCH_TABLE
306 --echo # Error: SHOW CREATE
TABLE was successful though we expected ER_NO_SUCH_TABLE)
311 EXECUTE create_table2;
313 let $value= INITIALIZED;
314 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
315 if (`SELECT
'$value' <>
'$cr_value2'`)
317 --echo # Error: Unexpected SHOW CREATE
TABLE output
319 --echo # Expected: $cr_value2
327 if (`EXECUTE stmt_break`)
332 DEALLOCATE PREPARE create_table1;
333 DEALLOCATE PREPARE create_table2;
334 DEALLOCATE PREPARE drop_table;
336 DEALLOCATE PREPARE show_table;