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)
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/ddl2.inc.
19 # Creation of this test:
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)
42 # Determine the current time.
44 # Run execution loops till the planned runtime is reached
47 let $loop_run= $loop_size;
51 --error 0,ER_TABLE_EXISTS_ERROR
55 --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
60 --error 0,ER_BAD_TABLE_ERROR
64 --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
70 if (`EXECUTE stmt_break`)
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)
87 eval PREPARE create_table FROM "$create_table";
89 eval PREPARE drop_table FROM "$drop_table";
92 # Determine the current time.
94 # Run execution loops till the planned runtime is reached
97 let $loop_run= $loop_size;
100 EXECUTE create_table;
101 --error 0,ER_TABLE_EXISTS_ERROR
102 EXECUTE create_table;
105 --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
110 --error 0,ER_BAD_TABLE_ERROR
114 --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
120 if (`EXECUTE stmt_break`)
125 DEALLOCATE PREPARE create_table;
126 DEALLOCATE PREPARE drop_table;
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)
140 # Determine the current time.
142 # Run execution loops till the planned runtime is reached
145 let $loop_run= $loop_size;
150 --error 0,ER_TABLE_EXISTS_ERROR
154 --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
161 --error 0,ER_BAD_TABLE_ERROR
165 --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
172 if (`EXECUTE stmt_break`)
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)
189 eval PREPARE create_table FROM "$create_table";
190 eval PREPARE drop_table FROM "$drop_table";
191 EXECUTE create_table;
193 eval PREPARE create_table FROM "$create_table";
194 eval PREPARE drop_table FROM "$drop_table";
198 # Determine the current time.
200 # Run execution loops till the planned runtime is reached
203 let $loop_run= $loop_size;
206 EXECUTE create_table;
208 --error 0,ER_TABLE_EXISTS_ERROR
209 EXECUTE create_table;
212 --echo # Error: CREATE TABLE was successful though we expected ER_TABLE_EXISTS_ERROR
219 --error 0,ER_BAD_TABLE_ERROR
223 --echo # Error: DROP TABLE was successful though we expected ER_BAD_TABLE_ERROR)
230 if (`EXECUTE stmt_break`)
235 DEALLOCATE PREPARE create_table;
236 DEALLOCATE PREPARE drop_table;
238 DEALLOCATE PREPARE create_table;
239 DEALLOCATE PREPARE drop_table;