~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to tests/test_tools/randgen/conf/drizzle/translog_concurrent2.yy

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2013-10-29 15:43:40 UTC
  • mfrom: (1.2.12) (2.1.19 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029154340-2gp39el6cv8bwf2o
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 workload suitable for testing the Drizzle 
 
19
# transaction_log.  It is intended for use with --threads >=1 and with the DrizzleTransactionLog Validator
 
20
# Using the Validator requires that we have a validation server running somewhere so we
 
21
# can try to replicate from SQL generated from the transaction_log (via drizzled/message/transaction_reader
 
22
#
 
23
# This is still a work in progress and is likely to change.
 
24
# We are generating a fair number of invalid queries and we could tighten things up, however,
 
25
# we have found a number of bugs with this grammar as it currently exists.
 
26
 
 
27
query:
 
28
        transaction | transaction | 
 
29
        normal_query | normal_query | normal_query ;
 
30
 
 
31
normal_query:
 
32
        select | select |
 
33
        select | select |
 
34
        select | select |
 
35
        select | select |
 
36
        insert_query | update | delete |
 
37
        insert_query | update | delete |
 
38
        insert_query | update | delete |
 
39
        insert_query | update | delete |
 
40
        insert_query | update | delete | 
 
41
        insert_query | update | delete |
 
42
        insert_query | update | delete |
 
43
        insert_query | update | delete |
 
44
        insert_query | update | delete |
 
45
        insert_query | update | delete |
 
46
        SAVEPOINT A | ROLLBACK TO SAVEPOINT A ;
 
47
 
 
48
normal_query_list:
 
49
  normal_query_list ; normal_query ; normal_query ; normal_query ; normal_query ; normal_query | 
 
50
  normal_query ; normal_query ; normal_query ; normal_query ; normal_query ; normal_query |
 
51
  normal_query ; normal_query ; normal_query ; normal_query ;
 
52
 
 
53
transaction:
 
54
  SET AUTOCOMMIT=OFF ; START TRANSACTION ; normal_query_list ; end_transaction ; SET AUTOCOMMIT=ON ;
 
55
 
 
56
end_transaction:
 
57
  commit_rollback ; 
 
58
 
 
59
commit_rollback:
 
60
  COMMIT | COMMIT | COMMIT | COMMIT | COMMIT | ROLLBACK ;
 
61
 
 
62
 
 
63
select:
 
64
        SELECT select_list FROM join_list where LIMIT large_digit for_update_lock_in_share_mode;
 
65
 
 
66
select_list:
 
67
        X . _field_key | X . _field_key |
 
68
        X . `pk` |
 
69
        X . _field |
 
70
        * |
 
71
        ( subselect );
 
72
 
 
73
subselect:
 
74
        SELECT _field_key FROM _table WHERE `pk` = value ;
 
75
 
 
76
# Use index for all joins
 
77
join_list:
 
78
        _table AS X | 
 
79
        _table AS X LEFT JOIN _table AS Y USING ( _field_key );
 
80
 
 
81
for_update_lock_in_share_mode:
 
82
        | | | | | 
 
83
        FOR UPDATE |
 
84
        LOCK IN SHARE MODE ;
 
85
 
 
86
ignore:
 
87
        | 
 
88
        IGNORE ;
 
89
 
 
90
low_priority:
 
91
        | | | LOW_PRIORITY;
 
92
 
 
93
insert_query:
 
94
  insert_replace INTO _table ( insert_column_list ) 
 
95
  SELECT insert_column_list 
 
96
  FROM _table where_insert 
 
97
  ORDER BY _field_list LIMIT insert_limit ;
 
98
 
 
99
insert_replace:
 
100
  INSERT | INSERT | INSERT | INSERT | INSERT |
 
101
  INSERT | INSERT | INSERT | INSERT | INSERT |
 
102
  REPLACE ;
 
103
 
 
104
insert_column_list:
 
105
# We use a set column list because even though all tables have the same
 
106
# columns, each table has a different order of those columns for 
 
107
# enhanced randomness
 
108
 `col_char_10` , `col_char_10_key` , `col_char_10_not_null` , `col_char_10_not_null_key` ,
 
109
 `col_char_1024` , `col_char_1024_key` , `col_char_1024_not_null` , `col_char_1024_not_null_key` ,
 
110
 `col_int` , `col_int_key` , `col_int_not_null` , `col_int_not_null_key` ,
 
111
 `col_bigint` , `col_bigint_key` , `col_bigint_not_null` , `col_bigint_not_null_key` ,
 
112
 `col_enum` , `col_enum_key` , `col_enum_not_null` , `col_enum_not_null_key` ,
 
113
 `col_text` , `col_text_key` , `col_text_not_null` , `col_text_not_null_key` 
 
114
 ;
 
115
 
 
116
update:
 
117
        UPDATE _table SET update_clause where_insert ORDER BY _field_list LIMIT large_digit ;
 
118
 
 
119
update_clause:
 
120
  no_pk_int_field_name = int_value ;
 
121
 
 
122
# We use a smaller limit on DELETE so that we delete less than we insert
 
123
 
 
124
delete:
 
125
        DELETE FROM _table where_insert ORDER BY _field_list LIMIT small_digit ;
 
126
 
 
127
quick:
 
128
        | 
 
129
        QUICK ;
 
130
 
 
131
order_by:
 
132
        | ORDER BY X . _field_key ;
 
133
 
 
134
# Use an index at all times
 
135
where:
 
136
        |
 
137
        WHERE X . _field_key < value |  # Use only < to reduce deadlocks
 
138
        WHERE X . _field_key IN ( value , value , value , value , value ) |
 
139
        WHERE X . int_field_name BETWEEN small_digit AND large_digit |
 
140
        WHERE X . int_field_name BETWEEN _tinyint_unsigned AND _int_unsigned ;
 
141
 
 
142
where_disabled: 
 
143
# only used in select's, but causing crashes on bad
 
144
# compares like enum to int
 
145
        WHERE X . _field_key = ( subselect ) ;
 
146
       
 
147
 
 
148
where_delete:
 
149
        | ;
 
150
        
 
151
 
 
152
where_insert:
 
153
    |
 
154
    WHERE int_field_name compare_operator int_value |
 
155
    WHERE char_field_name compare_operator char_value |
 
156
    WHERE int_field_name IN (int_value_list) |
 
157
    WHERE char_field_name IN (char_value_list) |
 
158
    WHERE int_field_name BETWEEN int_value AND int_value |
 
159
    WHERE int_field BETWEEN _tinyint_unsigned AND _int_unsigned |
 
160
    WHERE int_field BETWEEN small_digit AND large_digit |
 
161
    where_fuzz ;
 
162
 
 
163
where_fuzz:
 
164
# rules to introduce some fuzz testing 
 
165
# we deliberately allow the chance of bad
 
166
# comparisons here to see what happens
 
167
    WHERE _field_key = ( subselect ) |
 
168
    WHERE _field_key compare_operator value |
 
169
    WHERE _field_key IN ( subselect ) ;
 
170
 
 
171
compare_operator:
 
172
  = | = | = | = | < | > | <= | >= | != ;
 
173
 
 
174
 
 
175
 
 
176
int_value:
 
177
  _digit | _digit | large_digit | small_digit | 
 
178
  _digit | insert_limit | _tinyint_unsigned |
 
179
  _digit | _digit | large_digit | small_digit | 
 
180
  _digit | insert_limit | _tinyint_unsigned |
 
181
  value ;
 
182
 
 
183
int_value_list:  
 
184
  int_value_list, int_value | int_value | int_value ;
 
185
 
 
186
char_value:
 
187
  _char | _char | _quid ;
 
188
 
 
189
char_value_list:
 
190
  char_value_list, char_value | char_value | char_value ;
 
191
 
 
192
int_field_name:
 
193
    `pk` | `col_int_key` | `col_int` |
 
194
    `col_bigint` | `col_bigint_key` |
 
195
    `col_int_not_null` | `col_int_not_null_key` ;
 
196
 
 
197
no_pk_int_field_name:
 
198
    `col_int_key` | `col_int` |
 
199
    `col_bigint` | `col_bigint_key` |
 
200
    `col_int_not_null` | `col_int_not_null_key` ;    
 
201
 
 
202
 
 
203
char_field_name:
 
204
      `col_char_10` | `col_char_10_key` | `col_text_not_null` | `col_text_not_null_key` |
 
205
      `col_text_key` | `col_text` | `col_char_10_not_null_key` | `col_char_10_not_null` |
 
206
      `col_char_1024` | `col_char_1024_key` | `col_char_1024_not_null` | `col_char_1024_not_null_key` ;
 
207
 
 
208
large_digit:
 
209
        5 | 6 | 7 | 8 ;
 
210
 
 
211
small_digit:
 
212
        1 | 2 | 3 | 4 ;
 
213
 
 
214
insert_limit:
 
215
   10 | 10 | 25 | 25 | 25 | 25 | 50 | 50 | 100 ;
 
216
 
 
217
value:
 
218
        _digit | _tinyint_unsigned | _varchar(1) | _int_unsigned ;
 
219
 
 
220
zero_one:
 
221
        0 | 0 | 1;