1 ######## include/ddl7.inc ######
3 # Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
4 # and following SELECT/INSERT/SHOW etc.
5 # Subtest 7 variants (7A - 7D)
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 7 variants
26 # Scenario: CREATE INDEX/INSERT(F)/DROP INDEX/INSERT/CREATE INDEX(F)/DELETE
27 let $create_index= CREATE UNIQUE INDEX IDX1 ON t1 (f2);
28 let $insert_record= INSERT INTO t1 VALUES(1,1);
29 let $drop_index= DROP INDEX IDX1 ON t1;
30 let $delete_record= DELETE FROM t1 WHERE f1 = 1;
31 eval CREATE
TABLE t1 (f1 BIGINT, f2 BIGINT, PRIMARY
KEY(f1)) ENGINE=$engine_type;
32 INSERT INTO t1 VALUES(0,1);
33 #----------------------------------------------------------------------
36 --echo # Subtest 7
A (one connection, no PREPARE/EXECUTE)
37 --echo # connection action
38 --echo #
default: $create_index
39 --echo #
default: $insert_record (expect
to get ER_DUP_ENTRY)
40 --echo #
default: $drop_index
41 --echo #
default: $insert_record
42 --echo #
default: $create_index (expect
to get ER_DUP_ENTRY)
43 --echo #
default: $delete_record
49 # Determine the current time.
51 # Run execution loops till the planned runtime is reached
54 let $loop_run= $loop_size;
58 --error 0,ER_DUP_ENTRY
62 --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY
68 # NDB: ER_DUP_UNIQUE, others: ER_DUP_ENTRY
69 --error 0,ER_DUP_ENTRY,ER_DUP_UNIQUE
73 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY
74 --echo # Error: or ER_DUP_UNIQUE (NDB only)
81 if (`EXECUTE stmt_break`)
89 --echo # Subtest 7B (one connection, use PREPARE/EXECUTE)
90 --echo # connection action
91 --echo #
default: $create_index
92 --echo #
default: $insert_record (expect
to get ER_DUP_ENTRY)
93 --echo #
default: $drop_index
94 --echo #
default: $insert_record
95 --echo #
default: $create_index (expect
to get ER_DUP_ENTRY)
96 --echo #
default: $delete_record
100 eval PREPARE create_index FROM
"$create_index";
101 eval PREPARE insert_record FROM
"$insert_record";
102 eval PREPARE delete_record FROM
"$delete_record";
103 eval PREPARE drop_index FROM
"$drop_index";
106 # Determine the current time.
108 # Run execution loops till the planned runtime is reached
111 let $loop_run= $loop_size;
114 EXECUTE create_index;
115 --error 0,ER_DUP_ENTRY
116 EXECUTE insert_record;
119 --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY
124 EXECUTE insert_record;
125 --error 0,ER_DUP_ENTRY
126 EXECUTE create_index;
129 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY
133 EXECUTE delete_record;
136 if (`EXECUTE stmt_break`)
141 DEALLOCATE PREPARE create_index;
142 DEALLOCATE PREPARE insert_record;
143 DEALLOCATE PREPARE delete_record;
144 DEALLOCATE PREPARE drop_index;
148 --echo # Subtest 7C (two connections, no PREPARE/EXECUTE)
149 --echo # connection action
150 --echo #
default: $create_index
151 --echo #
default: $insert_record (expect
to get ER_DUP_ENTRY)
152 --echo # con2: $drop_index
153 --echo #
default: $insert_record
154 --echo # con2: $create_index (expect
to get ER_DUP_ENTRY)
155 --echo # con2: $delete_record
161 # Determine the current time.
163 # Run execution loops till the planned runtime is reached
166 let $loop_run= $loop_size;
170 --error 0,ER_DUP_ENTRY
174 --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY
183 --error 0,ER_DUP_ENTRY
187 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY
195 if (`EXECUTE stmt_break`)
203 --echo # Subtest 7D (two connections, use PREPARE/EXECUTE)
204 --echo # connection action
205 --echo #
default: $create_index
206 --echo #
default: $insert_record (expect
to get ER_DUP_ENTRY)
207 --echo # con2: $drop_index
208 --echo #
default: $insert_record
209 --echo # con2: $create_index (expect
to get ER_DUP_ENTRY)
210 --echo # con2: $delete_record
214 eval PREPARE create_index FROM
"$create_index";
215 eval PREPARE insert_record FROM
"$insert_record";
216 EXECUTE create_index;
218 eval PREPARE create_index FROM
"$create_index";
219 eval PREPARE drop_index FROM
"$drop_index";
220 eval PREPARE delete_record FROM
"$delete_record";
225 # Determine the current time.
227 # Run execution loops till the planned runtime is reached
230 let $loop_run= $loop_size;
233 EXECUTE create_index;
234 --error 0,ER_DUP_ENTRY
235 EXECUTE insert_record;
238 --echo # Error: INSERT was successful though we expected ER_DUP_ENTRY
245 EXECUTE insert_record;
247 --error 0,ER_DUP_ENTRY
248 EXECUTE create_index;
251 --echo # Error: CREATE INDEX was successful though we expected ER_DUP_ENTRY
255 EXECUTE delete_record;
259 if (`EXECUTE stmt_break`)
264 DEALLOCATE PREPARE create_index;
265 DEALLOCATE PREPARE insert_record;
267 DEALLOCATE PREPARE create_index;
268 DEALLOCATE PREPARE drop_index;
269 DEALLOCATE PREPARE delete_record;