1 ######## include/ddl6.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 6 variants (6A - 6D)
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 6 variants
26 # Scenario: CREATE INDEX/CREATE INDEX(F)/DROP INDEX/DROP INDEX(F)
27 let $create_index= CREATE INDEX IDX1 ON t1 (f2);
28 let $drop_index= DROP INDEX IDX1 ON t1;
29 eval CREATE
TABLE t1 (f1 BIGINT, f2 BIGINT, UNIQUE(f1)) ENGINE=$engine_type;
30 #----------------------------------------------------------------------
34 --echo # Subtest 6
A (one connection, no PREPARE/EXECUTE)
35 --echo # connection action
36 --echo #
default: $create_index
37 --echo #
default: $create_index (expect
to get ER_DUP_KEYNAME)
38 --echo #
default: $drop_index
39 --echo #
default: $drop_index (expect
to get ER_CANT_DROP_FIELD_OR_KEY)
40 --echo #
default: $create_index
41 --echo #
default: $drop_index
46 # Determine the current time.
48 # Run execution loops till the planned runtime is reached
51 let $loop_run= $loop_size;
55 --error 0,ER_DUP_KEYNAME
59 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
64 --error 0,ER_CANT_DROP_FIELD_OR_KEY
68 --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
76 if (`EXECUTE stmt_break`)
84 --echo # Subtest 6B (one connection, use PREPARE/EXECUTE)
85 --echo # connection action
86 --echo #
default: $create_index
87 --echo #
default: $create_index (expect
to get ER_DUP_KEYNAME)
88 --echo #
default: $drop_index
89 --echo #
default: $drop_index (expect
to get ER_CANT_DROP_FIELD_OR_KEY)
90 --echo #
default: $create_index
91 --echo #
default: $drop_index
95 eval PREPARE create_index FROM
"$create_index";
97 eval PREPARE drop_index FROM
"$drop_index";
100 # Determine the current time.
102 # Run execution loops till the planned runtime is reached
105 let $loop_run= $loop_size;
108 EXECUTE create_index;
109 --error 0,ER_DUP_KEYNAME
110 EXECUTE create_index;
113 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
118 --error 0,ER_CANT_DROP_FIELD_OR_KEY
122 --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
126 EXECUTE create_index;
130 if (`EXECUTE stmt_break`)
135 DEALLOCATE PREPARE create_index;
136 DEALLOCATE PREPARE drop_index;
140 --echo # Subtest 6C (two connections, no PREPARE/EXECUTE)
141 --echo # connection action
142 --echo #
default: $create_index
143 --echo # con2: $create_index (expect
to get ER_DUP_KEYNAME)
144 --echo #
default: $drop_index
145 --echo # con2: $drop_index (expect
to get ER_CANT_DROP_FIELD_OR_KEY)
146 --echo #
default: $create_index
147 --echo # con2: $drop_index
152 # Determine the current time.
154 # Run execution loops till the planned runtime is reached
157 let $loop_run= $loop_size;
162 --error 0,ER_DUP_KEYNAME
166 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
173 --error 0,ER_CANT_DROP_FIELD_OR_KEY
177 --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
188 if (`EXECUTE stmt_break`)
196 --echo # Subtest 6D (two connections, use PREPARE/EXECUTE)
197 --echo # connection action
198 --echo #
default: $create_index
199 --echo # con2: $create_index (expect
to get ER_DUP_KEYNAME)
200 --echo #
default: $drop_index
201 --echo # con2: $drop_index (expect
to get ER_CANT_DROP_FIELD_OR_KEY)
202 --echo #
default: $create_index
203 --echo # con2: $drop_index
207 eval PREPARE create_index FROM
"$create_index";
208 eval PREPARE drop_index FROM
"$drop_index";
209 EXECUTE create_index;
211 eval PREPARE create_index FROM
"$create_index";
212 eval PREPARE drop_index FROM
"$drop_index";
216 # Determine the current time.
218 # Run execution loops till the planned runtime is reached
221 let $loop_run= $loop_size;
224 EXECUTE create_index;
226 --error 0,ER_DUP_KEYNAME
227 EXECUTE create_index;
230 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
237 --error 0,ER_CANT_DROP_FIELD_OR_KEY
241 --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
246 EXECUTE create_index;
252 if (`EXECUTE stmt_break`)
257 DEALLOCATE PREPARE create_index;
258 DEALLOCATE PREPARE drop_index;
260 DEALLOCATE PREPARE create_index;
261 DEALLOCATE PREPARE drop_index;