1 ######## include/ddl8.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 8 variants (8A - 8D)
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 8 variants
26 # Scenario: CREATE INDEX variant1/SHOW/DROP INDEX/
27 # CREATE INDEX variant2/SHOW/DROP INDEX
28 let $create_index1= CREATE INDEX IDX ON t1 (f2);
29 let $create_index2= CREATE UNIQUE INDEX IDX ON t1 (f2);
30 let $show_table= SHOW CREATE TABLE t1;
31 let $drop_index= DROP INDEX IDX ON t1;
32 eval CREATE TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=$engine_type;
33 INSERT INTO t1 VALUES(1,1);
35 let $cr_value1= INITIALIZED;
36 let $cr_value1= query_get_value($show_table, Create Table, 1);
39 let $cr_value2= INITIALIZED;
40 let $cr_value2= query_get_value($show_table, Create Table, 1);
42 if (`SELECT '$cr_value1' = '$cr_value2'`)
44 --echo # Error during generation of prerequisites.
45 --echo # cr_value1 equals cr_value2
46 --echo # cr_value1: $cr_value1
47 --echo # cr_value2: $cr_value2
51 #----------------------------------------------------------------------
54 --echo # Subtest 8A (one connection, no PREPARE/EXECUTE)
55 --echo # connection action
56 --echo # default: $create_index1
57 --echo # default: $show_table
58 --echo # default: $drop_index
59 --echo # default: $create_index2
60 --echo # default: $show_table
61 --echo # default: $drop_index
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
87 let $value= INITIALIZED;
88 let $value= query_get_value($show_table, Create Table, 1);
89 if (`SELECT '$value' <> '$cr_value2'`)
91 --echo # Error: Unexpected SHOW CREATE TABLE output
93 --echo # Expected: $cr_value2
100 if (`EXECUTE stmt_break`)
108 --echo # Subtest 8B (one connection, use PREPARE/EXECUTE)
109 --echo # connection action
110 --echo # default: $create_index1
111 --echo # default: $show_table
112 --echo # default: $drop_index
113 --echo # default: $create_index2
114 --echo # default: $show_table
115 --echo # default: $drop_index
119 eval PREPARE create_index1 FROM "$create_index1";
120 eval PREPARE create_index2 FROM "$create_index2";
121 EXECUTE create_index1;
122 eval PREPARE show_table FROM "$show_table";
123 eval PREPARE drop_index FROM "$drop_index";
126 # Determine the current time.
128 # Run execution loops till the planned runtime is reached
131 let $loop_run= $loop_size;
134 EXECUTE create_index1;
135 let $value= INITIALIZED;
136 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
137 if (`SELECT '$value' <> '$cr_value1'`)
139 --echo # Error: Unexpected SHOW CREATE TABLE output
141 --echo # Expected: $cr_value1
146 EXECUTE create_index2;
147 let $value= INITIALIZED;
148 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
149 if (`SELECT '$value' <> '$cr_value2'`)
151 --echo # Error: Unexpected SHOW CREATE TABLE output
153 --echo # Expected: $cr_value2
160 if (`EXECUTE stmt_break`)
165 DEALLOCATE PREPARE create_index1;
166 DEALLOCATE PREPARE create_index2;
167 DEALLOCATE PREPARE show_table;
168 DEALLOCATE PREPARE drop_index;
172 --echo # Subtest 8C (two connections, no PREPARE/EXECUTE)
173 --echo # connection action
174 --echo # default: $create_index1
175 --echo # con2: $show_table
176 --echo # default: $drop_index
177 --echo # default: $create_index2
178 --echo # con2: $show_table
179 --echo # default: $drop_index
184 # Determine the current time.
186 # Run execution loops till the planned runtime is reached
189 let $loop_run= $loop_size;
194 let $value= INITIALIZED;
195 let $value= query_get_value($show_table, Create Table, 1);
196 if (`SELECT '$value' <> '$cr_value1'`)
198 --echo # Error: Unexpected SHOW CREATE TABLE output
200 --echo # Expected: $cr_value1
208 let $value= INITIALIZED;
209 let $value= query_get_value($show_table, Create Table, 1);
210 if (`SELECT '$value' <> '$cr_value2'`)
212 --echo # Error: Unexpected SHOW CREATE TABLE output
214 --echo # Expected: $cr_value2
222 if (`EXECUTE stmt_break`)
230 --echo # Subtest 8D (two connections, use PREPARE/EXECUTE)
231 --echo # connection action
232 --echo # default: $create_index1
233 --echo # con2: $show_table
234 --echo # default: $drop_index
235 --echo # default: $create_index2
236 --echo # con2: $show_table
237 --echo # default: $drop_index
241 eval PREPARE create_index1 FROM "$create_index1";
242 eval PREPARE create_index2 FROM "$create_index2";
243 eval PREPARE drop_index FROM "$drop_index";
244 EXECUTE create_index1;
246 eval PREPARE show_table FROM "$show_table";
250 # Determine the current time.
252 # Run execution loops till the planned runtime is reached
255 let $loop_run= $loop_size;
258 EXECUTE create_index1;
260 let $value= INITIALIZED;
261 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
262 if (`SELECT '$value' <> '$cr_value1'`)
264 --echo # Error: Unexpected SHOW CREATE TABLE output
266 --echo # Expected: $cr_value1
272 EXECUTE create_index2;
274 let $value= INITIALIZED;
275 let $value= query_get_value(EXECUTE show_table, Create Table, 1);
276 if (`SELECT '$value' <> '$cr_value2'`)
278 --echo # Error: Unexpected SHOW CREATE TABLE output
280 --echo # Expected: $cr_value2
288 if (`EXECUTE stmt_break`)
293 DEALLOCATE PREPARE create_index1;
294 DEALLOCATE PREPARE create_index2;
295 DEALLOCATE PREPARE drop_index;
297 DEALLOCATE PREPARE show_table;