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

« back to all changes in this revision

Viewing changes to tests/randgen/conf/engines/engine_stress.yy

  • Committer: Package Import Robot
  • Author(s): Tobias Frost
  • Date: 2013-08-22 20:18:31 UTC
  • mto: (20.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20130822201831-gn3ozsh7o7wmc5tk
Tags: upstream-7.2.3
ImportĀ upstreamĀ versionĀ 7.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Sun Microsystems, Inc. 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
 
#
19
 
# This grammar is suitable for general stress testing of storage engines
20
 
# including the InnoDB plugin and Falcon, their locking and transactional mechanisms. It can
21
 
# also be used along with the Combinations facility in order to provide stress testing under
22
 
# various configurations
23
 
#
24
 
# The goal is to spend as much time as possible inside the storage engine and as little time
25
 
# as possible in the optimizer. Therefore, most of the queries have trivial optimizer plans
26
 
# and run very quickly. 
27
 
#
28
 
# At the same time, please note that this grammar does not aim to cover all possible
29
 
# table access methods. The grammars from conf/optimizer/optimizer* are more suitable for that.
30
 
#
31
 
 
32
 
query:
33
 
        transaction |
34
 
        select | select |
35
 
        select | select |
36
 
        insert_replace | update | delete |
37
 
        insert_replace | update | delete |
38
 
        insert_replace | update | delete |
39
 
        insert_replace | update | delete |
40
 
        insert_replace | update | delete ;
41
 
 
42
 
transaction:
43
 
        START TRANSACTION |
44
 
        COMMIT ; SET TRANSACTION ISOLATION LEVEL isolation_level |
45
 
        ROLLBACK ; SET TRANSACTION ISOLATION LEVEL isolation_level |
46
 
        SAVEPOINT A | ROLLBACK TO SAVEPOINT A |
47
 
        SET AUTOCOMMIT=OFF | SET AUTOCOMMIT=ON ;
48
 
 
49
 
isolation_level:
50
 
        READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE ;
51
 
 
52
 
select:
53
 
        SELECT select_list FROM join_list where LIMIT large_digit for_update_lock_in_share_mode;
54
 
 
55
 
select_list:
56
 
        X . _field_key | X . _field_key |
57
 
        X . `pk` |
58
 
        X . _field |
59
 
        * |
60
 
        ( subselect );
61
 
 
62
 
subselect:
63
 
        SELECT _field_key FROM _table WHERE `pk` = value ;
64
 
 
65
 
# Use index for all joins
66
 
join_list:
67
 
        _table AS X | 
68
 
        _table AS X LEFT JOIN _table AS Y USING ( _field_key );
69
 
 
70
 
for_update_lock_in_share_mode:
71
 
        | | | | | 
72
 
        FOR UPDATE |
73
 
        LOCK IN SHARE MODE ;
74
 
 
75
 
# Insert more than we delete
76
 
insert_replace:
77
 
        i_r INTO _table (`pk`) VALUES (NULL) |
78
 
        i_r INTO _table ( _field_no_pk , _field_no_pk ) VALUES ( value , value ) , ( value , value ) |
79
 
        i_r INTO _table ( _field_no_pk ) SELECT _field_key FROM _table AS X where ORDER BY _field_list LIMIT large_digit;
80
 
 
81
 
i_r:
82
 
        INSERT low_priority |
83
 
        INSERT low_priority IGNORE |
84
 
        REPLACE low_priority;
85
 
 
86
 
ignore:
87
 
        | 
88
 
        IGNORE ;
89
 
 
90
 
low_priority:
91
 
        LOW_PRIORITY;
92
 
 
93
 
update:
94
 
        UPDATE low_priority ignore _table AS X SET _field_no_pk = value where ORDER BY _field_list LIMIT large_digit ;
95
 
 
96
 
# We use a smaller limit on DELETE so that we delete less than we insert
97
 
 
98
 
delete:
99
 
        DELETE low_priority quick ignore FROM _table where_delete ORDER BY _field_list LIMIT small_digit ;
100
 
 
101
 
quick:
102
 
        | 
103
 
        QUICK ;
104
 
 
105
 
order_by:
106
 
        | ORDER BY X . _field_key ;
107
 
 
108
 
# Use an index at all times
109
 
where:
110
 
        |
111
 
        WHERE X . _field_key < value |  # Use only < to reduce deadlocks
112
 
        WHERE X . _field_key IN ( value , value , value , value , value ) |
113
 
        WHERE X . _field_key BETWEEN small_digit AND large_digit |
114
 
        WHERE X . _field_key BETWEEN _tinyint_unsigned AND _int_unsigned |
115
 
        WHERE X . _field_key = ( subselect ) ;
116
 
 
117
 
where_delete:
118
 
        |
119
 
        WHERE _field_key = value |
120
 
        WHERE _field_key IN ( value , value , value , value , value ) |
121
 
        WHERE _field_key IN ( subselect ) |
122
 
        WHERE _field_key BETWEEN small_digit AND large_digit ;
123
 
 
124
 
large_digit:
125
 
        5 | 6 | 7 | 8 ;
126
 
 
127
 
small_digit:
128
 
        1 | 2 | 3 | 4 ;
129
 
 
130
 
value:
131
 
        _digit | _tinyint_unsigned | _varchar(1) | _int_unsigned ;
132
 
 
133
 
zero_one:
134
 
        0 | 0 | 1;