1 ######## include/ddl2.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 2 variants (2A - 2D)
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 2 variants
26 # Scenario: CREATE TABLE AS SELECT/SELECT/DROP/SELECT(F)
27 let $create_table= CREATE
TABLE t1 ENGINE = $engine_type AS SELECT 1 AS f1;
28 let $select_record= SELECT COUNT(*) <> 1 FROM t1 WHERE f1 = 1;
29 let $drop_table= DROP
TABLE t1;
30 #----------------------------------------------------------------------
33 --echo # Subtest 2
A (one connection, no PREPARE/EXECUTE)
34 --echo # connection action
35 --echo #
default: $create_table
36 --echo #
default: $select_record
37 --echo #
default: $drop_table
38 --echo #
default: $select_record (expect
to get ER_NO_SUCH_TABLE)
43 # Determine the current time.
45 # Run execution loops till the planned runtime is reached
48 let $loop_run= $loop_size;
56 --echo # Error: Unexpected content within t1.
65 --error 0,ER_NO_SUCH_TABLE
69 --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE
75 if (`EXECUTE stmt_break`)
83 --echo # Subtest 2B (one connection, use PREPARE/EXECUTE)
84 --echo # connection action
85 --echo #
default: $create_table
86 --echo #
default: $select_record
87 --echo #
default: $drop_table
88 --echo #
default: $select_record (expect
to get ER_NO_SUCH_TABLE)
94 eval PREPARE select_record FROM
"$select_record";
95 eval PREPARE drop_table FROM
"$drop_table";
98 # Determine the current time.
100 # Run execution loops till the planned runtime is reached
103 let $loop_run= $loop_size;
107 if (`EXECUTE select_record`)
111 --echo # Error: Unexpected content within t1.
114 EXECUTE select_record;
120 --error 0,ER_NO_SUCH_TABLE
121 EXECUTE select_record;
124 --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE
130 if (`EXECUTE stmt_break`)
136 DEALLOCATE PREPARE select_record;
137 DEALLOCATE PREPARE drop_table;
141 --echo # Subtest 2C (two connections, no PREPARE/EXECUTE)
142 --echo # connection action
143 --echo #
default: $create_table
144 --echo # con2: $select_record
145 --echo #
default: $drop_table
146 --echo # con2: $select_record (expect
to get ER_NO_SUCH_TABLE)
151 # Determine the current time.
153 # Run execution loops till the planned runtime is reached
156 let $loop_run= $loop_size;
161 if (`$select_record`)
165 --echo # Error: Unexpected content within t1.
176 --error 0,ER_NO_SUCH_TABLE
180 --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE
187 if (`EXECUTE stmt_break`)
195 --echo # Subtest 2D (two connections, use PREPARE/EXECUTE)
196 --echo # connection action
197 --echo #
default: $create_table
198 --echo # con2: $select_record
199 --echo #
default: $drop_table
200 --echo # con2: $select_record (expect
to get ER_NO_SUCH_TABLE)
204 eval PREPARE create_table FROM
"$create_table";
205 eval PREPARE drop_table FROM
"$drop_table";
208 eval PREPARE select_record FROM
"$select_record";
212 # Determine the current time.
214 # Run execution loops till the planned runtime is reached
217 let $loop_run= $loop_size;
222 if (`EXECUTE select_record`)
226 --echo # Error: Unexpected content within t1.
229 EXECUTE select_record;
237 --error 0,ER_NO_SUCH_TABLE
238 EXECUTE select_record;
241 --echo # Error: SELECT was successful though we expected ER_NO_SUCH_TABLE
248 if (`EXECUTE stmt_break`)
254 DEALLOCATE PREPARE drop_table;
256 DEALLOCATE PREPARE select_record;