~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/stress/include/ddl6.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
######## include/ddl6.inc ######
 
2
#
 
3
# Stress the storage engine with rapid CREATE/DROP TABLE/INDEX
 
4
# and following SELECT/INSERT/SHOW etc.
 
5
# Subtest 6 variants (6A - 6D)
 
6
#
 
7
# The variables
 
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.
 
12
#
 
13
# Other stuff which must already exist:
 
14
# - connection con2
 
15
# - stmt_start and stmt_break prepared by the default connection
 
16
#
 
17
# Please look for more details within include/ddl1.inc.
 
18
#
 
19
# Creation of this test:
 
20
# 2007-07-04 mleich
 
21
#
 
22
 
 
23
 
 
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
#----------------------------------------------------------------------
 
31
 
 
32
 
 
33
#
 
34
--echo # Subtest 6A (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
 
42
--disable_query_log
 
43
--disable_result_log
 
44
connection default;
 
45
let $run= 1;
 
46
# Determine the current time.
 
47
EXECUTE stmt_start;
 
48
# Run execution loops till the planned runtime is reached
 
49
while ($run)
 
50
{
 
51
   let $loop_run= $loop_size;
 
52
   while ($loop_run)
 
53
   {
 
54
      eval $create_index;
 
55
      --error 0,ER_DUP_KEYNAME
 
56
      eval $create_index;
 
57
      if (!$mysql_errno)
 
58
      {
 
59
         --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
 
60
         --echo # abort
 
61
         exit;
 
62
      }
 
63
      eval $drop_index;
 
64
      --error 0,ER_CANT_DROP_FIELD_OR_KEY
 
65
      eval $drop_index;
 
66
      if (!$mysql_errno)
 
67
      {
 
68
         --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
 
69
         --echo # abort
 
70
         exit;
 
71
      }
 
72
      eval $create_index;
 
73
      eval $drop_index;
 
74
      dec $loop_run;
 
75
   }
 
76
   if (`EXECUTE stmt_break`)
 
77
   {
 
78
      let $run= 0;
 
79
   }
 
80
}
 
81
--enable_result_log
 
82
--enable_query_log
 
83
#
 
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
 
92
--disable_query_log
 
93
--disable_result_log
 
94
connection default;
 
95
eval PREPARE create_index FROM "$create_index";
 
96
EXECUTE create_index;
 
97
eval PREPARE drop_index FROM "$drop_index";
 
98
EXECUTE drop_index;
 
99
let $run= 1;
 
100
# Determine the current time.
 
101
EXECUTE stmt_start;
 
102
# Run execution loops till the planned runtime is reached
 
103
while ($run)
 
104
{
 
105
   let $loop_run= $loop_size;
 
106
   while ($loop_run)
 
107
   {
 
108
      EXECUTE create_index;
 
109
      --error 0,ER_DUP_KEYNAME
 
110
      EXECUTE create_index;
 
111
      if (!$mysql_errno)
 
112
      {
 
113
         --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
 
114
         --echo # abort
 
115
         exit;
 
116
      }
 
117
      EXECUTE drop_index;
 
118
      --error 0,ER_CANT_DROP_FIELD_OR_KEY
 
119
      EXECUTE drop_index;
 
120
      if (!$mysql_errno)
 
121
      {
 
122
         --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
 
123
         --echo # abort
 
124
         exit;
 
125
      }
 
126
      EXECUTE create_index;
 
127
      EXECUTE drop_index;
 
128
      dec $loop_run;
 
129
   }
 
130
   if (`EXECUTE stmt_break`)
 
131
   {
 
132
      let $run= 0;
 
133
   }
 
134
}
 
135
DEALLOCATE PREPARE create_index;
 
136
DEALLOCATE PREPARE drop_index;
 
137
--enable_result_log
 
138
--enable_query_log
 
139
#
 
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
 
148
--disable_query_log
 
149
--disable_result_log
 
150
connection default;
 
151
let $run= 1;
 
152
# Determine the current time.
 
153
EXECUTE stmt_start;
 
154
# Run execution loops till the planned runtime is reached
 
155
while ($run)
 
156
{
 
157
   let $loop_run= $loop_size;
 
158
   while ($loop_run)
 
159
   {
 
160
      eval $create_index;
 
161
      connection con2;
 
162
      --error 0,ER_DUP_KEYNAME
 
163
      eval $create_index;
 
164
      if (!$mysql_errno)
 
165
      {
 
166
         --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
 
167
         --echo # abort
 
168
         exit;
 
169
      }
 
170
      connection default;
 
171
      eval $drop_index;
 
172
      connection con2;
 
173
      --error 0,ER_CANT_DROP_FIELD_OR_KEY
 
174
      eval $drop_index;
 
175
      if (!$mysql_errno)
 
176
      {
 
177
         --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
 
178
         --echo # abort
 
179
         exit;
 
180
      }
 
181
      connection default;
 
182
      eval $create_index;
 
183
      connection con2;
 
184
      eval $drop_index;
 
185
      connection default;
 
186
      dec $loop_run;
 
187
   }
 
188
   if (`EXECUTE stmt_break`)
 
189
   {
 
190
      let $run= 0;
 
191
   }
 
192
}
 
193
--enable_result_log
 
194
--enable_query_log
 
195
#
 
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
 
204
--disable_query_log
 
205
--disable_result_log
 
206
connection default;
 
207
eval PREPARE create_index FROM "$create_index";
 
208
eval PREPARE drop_index FROM "$drop_index";
 
209
EXECUTE create_index;
 
210
connection con2;
 
211
eval PREPARE create_index FROM "$create_index";
 
212
eval PREPARE drop_index FROM "$drop_index";
 
213
EXECUTE drop_index;
 
214
connection default;
 
215
let $run= 1;
 
216
# Determine the current time.
 
217
EXECUTE stmt_start;
 
218
# Run execution loops till the planned runtime is reached
 
219
while ($run)
 
220
{
 
221
   let $loop_run= $loop_size;
 
222
   while ($loop_run)
 
223
   {
 
224
      EXECUTE create_index;
 
225
      connection con2;
 
226
      --error 0,ER_DUP_KEYNAME
 
227
      EXECUTE create_index;
 
228
      if (!$mysql_errno)
 
229
      {
 
230
         --echo # Error: CREATE INDEX was successful though we expected ER_DUP_KEYNAME
 
231
         --echo # abort
 
232
         exit;
 
233
      }
 
234
      connection default;
 
235
      EXECUTE drop_index;
 
236
      connection con2;
 
237
      --error 0,ER_CANT_DROP_FIELD_OR_KEY
 
238
      EXECUTE drop_index;
 
239
      if (!$mysql_errno)
 
240
      {
 
241
         --echo # Error: DROP INDEX was successful though we expected ER_CANT_DROP_FIELD_OR_KEY
 
242
         --echo # abort
 
243
         exit;
 
244
      }
 
245
      connection default;
 
246
      EXECUTE create_index;
 
247
      connection con2;
 
248
      EXECUTE drop_index;
 
249
      connection default;
 
250
      dec $loop_run;
 
251
   }
 
252
   if (`EXECUTE stmt_break`)
 
253
   {
 
254
      let $run= 0;
 
255
   }
 
256
}
 
257
DEALLOCATE PREPARE create_index;
 
258
DEALLOCATE PREPARE drop_index;
 
259
connection con2;
 
260
DEALLOCATE PREPARE create_index;
 
261
DEALLOCATE PREPARE drop_index;
 
262
connection default;
 
263
--enable_result_log
 
264
--enable_query_log
 
265
 
 
266
DROP TABLE t1;