~ubuntu-branches/ubuntu/vivid/drizzle/vivid

« back to all changes in this revision

Viewing changes to tests/test_tools/randgen/conf/percona/trx_crash_commit_after.yy

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (20.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131029154340-j36v7gxq9tm1gi5f
Tags: 1:7.2.3-2ubuntu1
* Merge from debian, remaining changes:
  - Link against boost_system because of boost_thread.
  - Add required libs to message/include.am
  - Add upstart job and adjust init script to be upstart compatible.
  - Disable -floop-parallelize-all due to gcc-4.8/4.9 compiler ICE
    http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57732

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2010 Patrick Crews. All rights reserved.
 
2
# Use is subject to license terms.
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; version 2 of the License.
 
7
#
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 
11
# General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program; if not, write to the Free Software
 
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
 
16
# USA
 
17
 
 
18
# This grammar is designed to generate a transactional workload for validating transaction handling and replication
 
19
# setups
 
20
#
 
21
# This is still a work in progress and is likely to change.
 
22
# We are generating a fair number of invalid queries and we could tighten things up, however,
 
23
# we have found a number of bugs with this grammar as it currently exists.
 
24
 
 
25
query:
 
26
       query_type ;
 
27
 
 
28
query_type:
 
29
        valid_query | valid_query | valid_query | valid_query | valid_query | 
 
30
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
31
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
32
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
33
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
34
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
35
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
36
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
37
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
38
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
39
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
40
        valid_query | valid_query | valid_query | valid_query | valid_query |
 
41
        set_debug | set_debug ; 
 
42
 
 
43
valid_query: 
 
44
        transaction | transaction | transaction | transaction |
 
45
        normal_query | normal_query | normal_query  ;
 
46
 
 
47
set_debug:
 
48
        SET SESSION debug="d,crash_commit_after";
 
49
 
 
50
normal_query:
 
51
        select | select |
 
52
        select | select |
 
53
        select | select |
 
54
        select | select |
 
55
        insert_query | update | delete |
 
56
        insert_query | update | delete |
 
57
        insert_query | update | delete |
 
58
        insert_query | update | delete |
 
59
        insert_query | update | delete | 
 
60
        insert_query | update | delete |
 
61
        insert_query | update | delete |
 
62
        insert_query | update | delete |
 
63
        insert_query | update | delete |
 
64
        insert_query | update | delete |
 
65
        SAVEPOINT A /*Generated by THREAD_ID _thread_id*/ | 
 
66
        ROLLBACK TO SAVEPOINT A /*Generated by THREAD_ID _thread_id*/ ;
 
67
 
 
68
normal_query_list:
 
69
  normal_query_list ; normal_query ; normal_query ; normal_query ; normal_query ; normal_query | 
 
70
  normal_query ; normal_query ; normal_query ; normal_query ; normal_query ; normal_query |
 
71
  normal_query ; normal_query ; normal_query ; normal_query ;
 
72
 
 
73
transaction:
 
74
  SET AUTOCOMMIT=OFF /*Generated by THREAD_ID _thread_id*/ ; START TRANSACTION /*Generated by THREAD_ID _thread_id*/ ; normal_query_list ; end_transaction ; SET AUTOCOMMIT=ON /*Generated by THREAD_ID _thread_id*/ ;
 
75
 
 
76
end_transaction:
 
77
  commit_rollback ; 
 
78
 
 
79
commit_rollback:
 
80
  COMMIT /*Generated by THREAD_ID _thread_id*/| 
 
81
  COMMIT /*Generated by THREAD_ID _thread_id*/| 
 
82
  COMMIT /*Generated by THREAD_ID _thread_id*/| 
 
83
  COMMIT /*Generated by THREAD_ID _thread_id*/| 
 
84
  COMMIT /*Generated by THREAD_ID _thread_id*/| 
 
85
  ROLLBACK /*Generated by THREAD_ID _thread_id*/;
 
86
 
 
87
 
 
88
select:
 
89
        SELECT select_list FROM join_list where LIMIT large_digit for_update_lock_in_share_mode /*Generated by THREAD_ID _thread_id*/ ;
 
90
 
 
91
select_list:
 
92
        X . _field_key | X . _field_key |
 
93
        X . `pk` |
 
94
        X . _field |
 
95
        * |
 
96
        ( subselect );
 
97
 
 
98
subselect:
 
99
        SELECT _field_key FROM _table WHERE `pk` = value ;
 
100
 
 
101
# Use index for all joins
 
102
join_list:
 
103
        _table AS X | 
 
104
        _table AS X LEFT JOIN _table AS Y USING ( _field_key );
 
105
 
 
106
for_update_lock_in_share_mode:
 
107
        | | | | | 
 
108
        FOR UPDATE |
 
109
        LOCK IN SHARE MODE ;
 
110
 
 
111
ignore:
 
112
        | 
 
113
        IGNORE ;
 
114
 
 
115
low_priority:
 
116
        | | | LOW_PRIORITY;
 
117
 
 
118
insert_query:
 
119
  insert_replace INTO _table ( insert_column_list ) 
 
120
  SELECT insert_column_list 
 
121
  FROM _table where_insert 
 
122
  ORDER BY _field_list LIMIT insert_limit /*Generated by THREAD_ID _thread_id*/;
 
123
 
 
124
insert_replace:
 
125
  INSERT | INSERT | INSERT | INSERT | INSERT |
 
126
  INSERT | INSERT | INSERT | INSERT | INSERT |
 
127
  REPLACE ;
 
128
 
 
129
insert_column_list:
 
130
# We use a set column list because even though all tables have the same
 
131
# columns, each table has a different order of those columns for 
 
132
# enhanced randomness
 
133
 `col_char_10` , `col_char_10_key` , `col_char_10_not_null` , `col_char_10_not_null_key` ,
 
134
 `col_char_255` , `col_char_255_key` , `col_char_255_not_null` , `col_char_255_not_null_key` ,
 
135
 `col_int` , `col_int_key` , `col_int_not_null` , `col_int_not_null_key` ,
 
136
 `col_bigint` , `col_bigint_key` , `col_bigint_not_null` , `col_bigint_not_null_key` ,
 
137
 `col_enum` , `col_enum_key` , `col_enum_not_null` , `col_enum_not_null_key` 
 
138
 ;
 
139
 
 
140
update:
 
141
        UPDATE _table SET update_clause where_insert ORDER BY _field_list LIMIT large_digit /*Generated by THREAD_ID _thread_id*/ ;
 
142
 
 
143
update_clause:
 
144
  no_pk_int_field_name = int_value ;
 
145
 
 
146
# We use a smaller limit on DELETE so that we delete less than we insert
 
147
 
 
148
delete:
 
149
        DELETE FROM _table where_insert ORDER BY _field_list LIMIT small_digit /*Generated by THREAD_ID _thread_id*/ ;
 
150
 
 
151
quick:
 
152
        | 
 
153
        QUICK ;
 
154
 
 
155
order_by:
 
156
        | ORDER BY X . _field_key ;
 
157
 
 
158
# Use an index at all times
 
159
where:
 
160
        |
 
161
        WHERE X . _field_key < value |  # Use only < to reduce deadlocks
 
162
        WHERE X . _field_key IN ( value , value , value , value , value ) |
 
163
        WHERE X . int_field_name BETWEEN small_digit AND large_digit |
 
164
        WHERE X . int_field_name BETWEEN _tinyint_unsigned AND _int_unsigned ;
 
165
 
 
166
where_disabled: 
 
167
# only used in select's, but causing crashes on bad
 
168
# compares like enum to int
 
169
        WHERE X . _field_key = ( subselect ) ;
 
170
       
 
171
 
 
172
where_delete:
 
173
        | ;
 
174
        
 
175
 
 
176
where_insert:
 
177
    |
 
178
    WHERE int_field_name compare_operator int_value |
 
179
    WHERE char_field_name compare_operator char_value |
 
180
    WHERE int_field_name IN (int_value_list) |
 
181
    WHERE char_field_name IN (char_value_list) |
 
182
    WHERE int_field_name BETWEEN int_value AND int_value |
 
183
    WHERE int_field BETWEEN _tinyint_unsigned AND _int_unsigned |
 
184
    WHERE int_field BETWEEN small_digit AND large_digit |
 
185
    where_fuzz ;
 
186
 
 
187
where_fuzz:
 
188
# rules to introduce some fuzz testing 
 
189
# we deliberately allow the chance of bad
 
190
# comparisons here to see what happens
 
191
    WHERE _field_key = ( subselect ) |
 
192
    WHERE _field_key compare_operator value |
 
193
    WHERE _field_key IN ( subselect ) ;
 
194
 
 
195
compare_operator:
 
196
  = | = | = | = | < | > | <= | >= | != ;
 
197
 
 
198
 
 
199
 
 
200
int_value:
 
201
  _digit | _digit | large_digit | small_digit | 
 
202
  _digit | insert_limit | _tinyint_unsigned |
 
203
  _digit | _digit | large_digit | small_digit | 
 
204
  _digit | insert_limit | _tinyint_unsigned |
 
205
  value ;
 
206
 
 
207
int_value_list:  
 
208
  int_value_list, int_value | int_value | int_value ;
 
209
 
 
210
char_value:
 
211
  _char | _char | _quid ;
 
212
 
 
213
char_value_list:
 
214
  char_value_list, char_value | char_value | char_value ;
 
215
 
 
216
int_field_name:
 
217
    `pk` | `col_int_key` | `col_int` |
 
218
    `col_bigint` | `col_bigint_key` |
 
219
    `col_int_not_null` | `col_int_not_null_key` ;
 
220
 
 
221
no_pk_int_field_name:
 
222
    `col_int_key` | `col_int` |
 
223
    `col_bigint` | `col_bigint_key` |
 
224
    `col_int_not_null` | `col_int_not_null_key` ;    
 
225
 
 
226
 
 
227
char_field_name:
 
228
      `col_char_10` | `col_char_10_key` | 
 
229
      `col_char_10_not_null_key` | `col_char_10_not_null` |
 
230
      `col_char_255` | `col_char_255_key` |
 
231
      `col_char_255_not_null` | `col_char_255_not_null_key` ;
 
232
 
 
233
large_digit:
 
234
        5 | 6 | 7 | 8 ;
 
235
 
 
236
small_digit:
 
237
        1 | 2 | 3 | 4 ;
 
238
 
 
239
insert_limit:
 
240
   10 | 10 | 25 | 25 | 25 | 25 | 50 | 50 | 100 ;
 
241
 
 
242
value:
 
243
        _digit | _tinyint_unsigned | _varchar(1) | _int_unsigned ;
 
244
 
 
245
zero_one:
 
246
        0 | 0 | 1;