Merge lp:~kalebral-deactivatedaccount/randgen/add-drizzle-config-files into lp:randgen

Proposed by Lee Bieber
Status: Merged
Merge reported by: Patrick Crews
Merged at revision: not available
Proposed branch: lp:~kalebral-deactivatedaccount/randgen/add-drizzle-config-files
Merge into: lp:randgen
Diff against target: 447 lines (+428/-0)
4 files modified
conf/collations_drizzle.yy (+22/-0)
conf/outer_join_drizzle.zz (+16/-0)
conf/range_access_drizzle.yy (+373/-0)
conf/range_access_drizzle.zz (+17/-0)
To merge this branch: bzr merge lp:~kalebral-deactivatedaccount/randgen/add-drizzle-config-files
Reviewer Review Type Date Requested Status
Bernt M Johnsen Approve
Review via email: mp+18328@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Lee Bieber (kalebral-deactivatedaccount) wrote :

Added some drizzle configuration files

Revision history for this message
Bernt M Johnsen (bernt-johnsen) wrote :

ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'conf/collations_drizzle.yy'
2--- conf/collations_drizzle.yy 1970-01-01 00:00:00 +0000
3+++ conf/collations_drizzle.yy 2010-01-31 04:22:11 +0000
4@@ -0,0 +1,22 @@
5+query:
6+ delete | insert | update ;
7+
8+xid_event:
9+ START TRANSACTION | COMMIT ;
10+insert:
11+ INSERT INTO table_name ( field_name ) VALUES ( ' letter ' ) ;
12+
13+update:
14+ UPDATE table_name ' letter ' WHERE field_name oper ' letter ';
15+
16+delete:
17+ DELETE FROM table_name WHERE field_name oper ' letter ';
18+
19+table_name:
20+ _table ;
21+
22+field_name:
23+ `col_varchar_key` | `col_varchar_nokey` ;
24+
25+oper:
26+ = | > | < | >= | <= | <> ;
27
28=== added file 'conf/outer_join_drizzle.zz'
29--- conf/outer_join_drizzle.zz 1970-01-01 00:00:00 +0000
30+++ conf/outer_join_drizzle.zz 2010-01-31 04:22:10 +0000
31@@ -0,0 +1,16 @@
32+$tables = {
33+ names => ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II', 'JJ', 'KK', 'LL', 'MM', 'NN', 'OO', 'PP'],
34+ rows => [0, 1, 2, 5, 6, 7, 8, 9, 10, 20, 21, 22, 23, 24, 25, 100],
35+ engines => ['Innodb']
36+};
37+
38+$fields = {
39+ types => [ 'int', 'varchar(10)', 'varchar(1024)' ],
40+ indexes => [undef, 'key' ],
41+ null => [undef ]
42+};
43+
44+$data => {
45+ numbers => [ 'digit', 'null', undef ],
46+ strings => [ 'letter', 'english' , 'string(1024)']
47+};
48
49=== added file 'conf/range_access_drizzle.yy'
50--- conf/range_access_drizzle.yy 1970-01-01 00:00:00 +0000
51+++ conf/range_access_drizzle.yy 2010-01-31 04:22:11 +0000
52@@ -0,0 +1,373 @@
53+################################################################################
54+# range_access.yy
55+# Purpose: For testing the range optimization for MySQL
56+# gendata: Use with conf/range_access.zz as a gendata file
57+# parameters:
58+# queries = 10k+
59+# threads = 1
60+# no need for an engine argument - we mix storage engines via the gendata file
61+# uses:
62+# valgrind - use MarkErrorLog Validator + --valgrind
63+# comparison between MySQL versions / configurations
64+# 3way compares to javadb and postgres
65+#
66+# NOTES: This grammar will run against either a single or multi-part index
67+# For multi-part indexes, the index will be created, a set of queries
68+# will be run, then the index will be dropped
69+#
70+# TODO: It would be nice to dynamically create indexes or to create
71+# more complex indexes on multiple tables at a time
72+# but this is more than a little tricky
73+################################################################################
74+
75+
76+query:
77+ { $idx_table = '' ; @idx_fields = () ; "" } query_type ;
78+
79+query_type:
80+ single_idx_query_set | dual_int_idx_query_set | dual_char_idx_query_set | tri_int_idx_query_set ;
81+
82+single_idx_query_set:
83+ single_idx_query ; single_idx_query ; single_idx_query ; single_idx_query ; single_idx_query ;
84+
85+dual_int_idx_query_set:
86+ new_dual_int_index ; multi_int_idx_query_set ;
87+
88+dual_char_idx_query_set:
89+ new_dual_char_index ; multi_char_idx_query_set ;
90+
91+tri_int_idx_query_set:
92+ new_tri_int_index ; multi_int_idx_query_set ;
93+
94+tri_char_idx_query_set:
95+ new_tri_char_index ; multi_char_idx_query_set ;
96+
97+wild_query:
98+ single_idx_query | multi_int_idx_query | multi_char_idx_query ;
99+
100+multi_int_idx_query_set:
101+ multi_int_idx_query ; multi_int_idx_query ; multi_int_idx_query ; multi_int_idx_query ; multi_int_idx_query ; wild_query ; drop_index ;
102+
103+multi_char_idx_query_set:
104+ multi_char_idx_query ; multi_char_idx_query ; multi_char_idx_query ; multi_char_idx_query ; multi_char_idx_query ; wild_query ; drop_index ;
105+
106+################################################################################
107+# index-specific rules
108+################################################################################
109+
110+drop_index:
111+ DROP INDEX `test_idx` ON { $idx_table } ;
112+
113+index_pre:
114+ ALTER TABLE index_table ADD INDEX `test_idx` USING index_type ;
115+
116+new_dual_int_index:
117+ index_pre (dual_int_idx_field_list) ;
118+
119+new_dual_char_index:
120+ index_pre (dual_char_idx_field_list) ;
121+
122+new_tri_int_index:
123+ index_pre (tri_int_idx_field_list) ;
124+
125+new_tri_char_index:
126+ index_pre (tri_char_idx_field_list) ;
127+
128+dual_int_idx_field_list:
129+ `pk`, `col_int_key` { @idx_fields =("`pk`", "`col_int_key`") ; "" } |
130+ `col_int_key` , `pk` { @idx_fields =("`col_int_key`", "`pk`") ; "" } |
131+ `col_int_key` , `col_int` { @idx_fields =("`col_int_key`", "`col_int`") ; "" } ;
132+
133+dual_char_idx_field_list:
134+ `col_varchar_10_utf8`( small_length ) , `col_varchar_1024_utf8`( large_length ) {@idx_fields = ("`col_varchar_10_utf8`", "`col_varchar_1024_utf8`") ; "" } ;
135+
136+tri_int_idx_field_list:
137+ `pk`, `col_int_key`, `col_int` { @idx_fields =("`pk`", "`col_int_key`", "`col_int`") ; "" } |
138+ `col_int_key` , `pk` , `col_int` { @idx_fields =("`col_int_key`", "`pk`", "`col_int`") ; "" } |
139+ `col_int_key` , `col_int`, `pk` { @idx_fields =("`col_int_key`", "`col_int`", "`pk`") ; "" } ;
140+
141+tri_char_idx_field_list:
142+ `col_varchar_10_utf8`( small_length ) , `col_varchar_1024_utf8`( large_length ) {@idx_fields = ("`col_varchar_10_utf8`", "`col_varchar_1024_utf8`") ; "" } ;
143+
144+################################################################################
145+# single index rules
146+################################################################################
147+
148+single_idx_where_list:
149+ single_int_idx_where_clause | single_char_idx_where_clause |
150+ single_idx_where_list and_or single_int_idx_where_clause |
151+ single_idx_where_list and_or single_char_idx_where_clause ;
152+
153+
154+single_int_idx_where_clause:
155+ { my @int_idx_fields = ("`pk`" , "`col_int_key`") ; $int_idx_field = ("table".$prng->int(1,$tables))." . ".$prng->arrayElement(\@int_idx_fields) ; "" } single_int_idx_where_list ;
156+
157+
158+single_int_idx_where_list:
159+ single_int_idx_where_list or_and single_int_idx_where_item |
160+ single_int_idx_where_item | single_int_idx_where_item ;
161+
162+single_int_idx_where_item:
163+ { $int_idx_field } greater_than _digit[invariant] AND { $int_idx_field } less_than ( _digit[invariant] + increment ) |
164+ { $int_idx_field } greater_than _digit[invariant] AND { $int_idx_field } less_than ( _digit[invariant] + increment ) |
165+ { $int_idx_field } greater_than _digit AND { $int_idx_field } less_than ( _digit[invariant] + int_value ) |
166+ { $int_idx_field } greater_than _digit[invariant] AND { $int_idx_field } less_than ( _digit + int_value ) |
167+ { $int_idx_field } greater_than _digit AND { $int_idx_field } less_than ( _digit + increment ) |
168+ { $int_idx_field } comparison_operator int_value |
169+ { $int_idx_field } not_equal int_value |
170+ { $int_idx_field } not IN (number_list) |
171+ { $int_idx_field } not BETWEEN _digit[invariant] AND (_digit[invariant] + int_value ) |
172+ { $int_idx_field } IS not NULL ;
173+
174+
175+single_char_idx_where_clause:
176+ { my @char_idx_fields = ("`col_varchar_10_utf8_key`", "`col_varchar_1024_utf8_key`") ; $char_idx_field = ("table".$prng->int(1,$tables))." . ".$prng->arrayElement(\@char_idx_fields) ; "" } single_char_idx_where_list ;
177+
178+single_char_idx_where_list:
179+ single_char_idx_where_list and_or single_char_idx_where_item |
180+ single_char_idx_where_item | single_char_idx_where_item ;
181+
182+single_char_idx_where_item:
183+ { $char_idx_field } greater_than _char AND { $char_idx_field } less_than 'z' |
184+ { $char_idx_field } greater_than _char AND { $char_idx_field } less_than 'z' |
185+ { $char_idx_field } greater_than _char AND { $char_idx_field } less_than 'z' |
186+ { $char_idx_field } greater_than char_value AND { $char_idx_field } less_than char_value |
187+ { $char_idx_field } greater_than char_value AND { $char_idx_field } less_than 'zzzz' |
188+ { $char_idx_field } IS not NULL |
189+ { $char_idx_field } not IN (char_list) |
190+ { $char_idx_field } not LIKE ( char_pattern ) |
191+ { $char_idx_field } not BETWEEN _char AND 'z' ;
192+
193+################################################################################
194+# multi-part index rules
195+################################################################################
196+
197+multi_int_idx_where_list:
198+ multi_int_idx_where_clause |
199+ multi_int_idx_where_list and_or multi_int_idx_where_clause | multi_int_idx_where_list and_or multi_int_idx_where_clause ;
200+
201+
202+multi_int_idx_where_clause:
203+ { $int_idx_field = ("table".$prng->int(1,$tables))." . ".$prng->arrayElement(\@idx_fields) ; "" } single_int_idx_where_list ;
204+
205+# char rules
206+multi_char_idx_where_list:
207+ multi_char_idx_where_clause |
208+ multi_char_idx_where_list and_or multi_char_idx_where_clause | multi_char_idx_where_list and_or multi_char_idx_where_clause ;
209+
210+multi_char_idx_where_clause:
211+ { $char_idx_field = ("table".$prng->int(1,$tables))." . ".$prng->arrayElement(\@idx_fields) ; "" } single_char_idx_where_list ;
212+
213+
214+
215+################################################################################
216+# general-purpose query rules
217+################################################################################
218+
219+single_idx_query:
220+ { $tables=0 ; $fields = 0 ; "" } SELECT select_list FROM join WHERE single_idx_where_list opt_where_list order_by_clause ;
221+
222+multi_int_idx_query:
223+ { $tables=0 ; $fields = 0 ; "" } SELECT select_list FROM idx_join WHERE multi_int_idx_where_list opt_where_list order_by_clause ;
224+
225+multi_char_idx_query:
226+ { $tables=0 ; $fields = 0 ; "" } SELECT select_list FROM idx_join WHERE multi_char_idx_where_list opt_where_list order_by_clause ;
227+
228+select_list:
229+ select_item | select_item , select_list ;
230+
231+select_item:
232+ table_one_two . _field AS { my $f = "field".++$fields ; $f } ;
233+
234+join:
235+ { $stack->push() }
236+ table_or_join
237+ { $stack->set("left",$stack->get("result")); }
238+ left_right outer JOIN table_or_join
239+ ON
240+ join_condition ;
241+
242+idx_join:
243+ { $stack->push() }
244+ idx_table_for_join
245+ { $stack->set("left",$stack->get("result")); }
246+ left_right outer JOIN table_or_join
247+ ON
248+ join_condition ;
249+
250+join_condition:
251+ int_condition | char_condition ;
252+
253+int_condition:
254+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_indexed =
255+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_indexed
256+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } |
257+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_indexed =
258+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_field_name
259+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } |
260+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_field_name =
261+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/,
262+ $table_string); $table_array[1] } . int_indexed
263+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } |
264+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . int_field_name =
265+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/,
266+ $table_string); $table_array[1] } . int_field_name
267+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } ;
268+
269+char_condition:
270+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_field_name =
271+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_field_name
272+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } |
273+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_indexed =
274+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_field_name
275+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } |
276+ { my $left = $stack->get("left"); my %s=map{$_=>1} @$left; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_field_name =
277+ { my $right = $stack->get("result"); my %s=map{$_=>1} @$right; my @r=(keys %s); my $table_string = $prng->arrayElement(\@r); my @table_array = split(/AS/, $table_string); $table_array[1] } . char_indexed
278+ { my $left = $stack->get("left"); my $right = $stack->get("result"); my @n = (); push(@n,@$right); push(@n,@$left); $stack->pop(\@n); return undef } ;
279+
280+table_or_join:
281+ table | table | table | table | table | table |
282+ table | table | join | join ;
283+
284+table:
285+# We use the "AS table" bit here so we can have unique aliases if we use the same table many times
286+ { $stack->push(); my $x = $prng->arrayElement($executors->[0]->tables())." AS table".++$tables; my @s=($x); $stack->pop(\@s); $x } ;
287+
288+idx_table_for_join:
289+ { $stack->push() ; my $x = $idx_table." AS table".++$tables; my @s=($x); $stack->pop(\@s); $x } ;
290+
291+join_type:
292+ INNER JOIN | left_right outer JOIN | STRAIGHT_JOIN ;
293+
294+left_right:
295+ LEFT | LEFT | LEFT | RIGHT ;
296+
297+outer:
298+ | | | | OUTER ;
299+
300+index_type:
301+ BTREE | HASH ;
302+
303+index_table:
304+ { my $idx_table_candidate = $prng->arrayElement($executors->[0]->tables()) ; $idx_table = $idx_table_candidate ; $idx_table } ;
305+
306+opt_where_list:
307+ | | | | and_or where_list ;
308+
309+where_list:
310+ where_item | where_item | where_item | ( where_list and_or where_item ) ;
311+
312+where_item:
313+ existing_table_item . int_field_name comparison_operator int_value |
314+ existing_table_item . char_field_name comparison_operator _char |
315+ existing_table_item . int_field_name comparison_operator int_value |
316+ existing_table_item . int_field_name comparison_operator existing_table_item . int_field_name |
317+ existing_table_item . char_field_name comparison_operator _char |
318+ existing_table_item . char_field_name comparison_operator existing_table_item . char_field_name |
319+ existing_table_item . _field IS not NULL |
320+ existing_table_item . `pk` IS not NULL |
321+ single_idx_where_list ;
322+
323+order_by_clause:
324+ | | |
325+ ORDER BY total_order_by desc limit |
326+ ORDER BY order_by_list ;
327+
328+total_order_by:
329+ { join(', ', map { "field".$_ } (1..$fields) ) };
330+
331+order_by_list:
332+ order_by_item |
333+ order_by_item , order_by_list ;
334+
335+order_by_item:
336+ existing_select_item desc ;
337+
338+desc:
339+ ASC | | | | DESC ;
340+
341+limit:
342+ | | LIMIT limit_size | LIMIT limit_size OFFSET int_value;
343+
344+limit_size:
345+ 1 | 2 | 10 | 100 | 1000;
346+
347+################################################################################
348+# utility / helper rules
349+################################################################################
350+
351+new_table_item:
352+ _table AS { "table".++$tables };
353+
354+existing_table_item:
355+ { "table".$prng->int(1,$tables) };
356+
357+existing_select_item:
358+ { "field".$prng->int(1,$fields) };
359+
360+comparison_operator:
361+ = | > | < | != | <> | <= | >= ;
362+
363+greater_than:
364+ > | >= ;
365+
366+less_than:
367+ < | <= ;
368+
369+not_equal:
370+ <> | != ;
371+
372+int_value:
373+ _digit | _digit | _digit | _digit | _digit | digit | other_int ;
374+
375+other_int:
376+ _tinyint_unsigned | 20 | 25 | 30 | 35 | 50 | 65 | 75 | 100 ;
377+
378+char_value:
379+ _char | _char | _char | _quid | _english ;
380+
381+char_pattern:
382+ char_value | char_value | CONCAT( _char, '%') | 'a%'| _quid | '_' | '_%' ;
383+
384+increment:
385+ 1 | 1 | 2 | 2 | 5 | 5 | 6 | 10 ;
386+
387+large_length:
388+ 200 | 200 | 200 | 200 | 200 | 100 | 200 | 250 | 37 | 50 | 175 | small_length ;
389+
390+small_length:
391+ 1 | 2 | 5 | 7 | 8 | 9 | 10 | 10 | 10 | 10 ;
392+
393+random_length:
394+ large_length | large_length | small_length ;
395+
396+int_indexed:
397+ `pk` | `col_int_key` ;
398+
399+int_field_name:
400+ `pk` | `col_int_key` | `col_int` ;
401+
402+char_indexed:
403+ `col_varchar_10_utf8_key` | `col_varchar_1024_utf8_key`;
404+
405+char_field_name:
406+ `col_varchar_10_utf8_key` | `col_varchar_1024_utf8_key` | `col_varchar_10_utf8` | `col_varchar_1024_utf8` ;
407+
408+number_list:
409+ int_value | number_list, int_value ;
410+
411+char_list:
412+ _char | char_list, _char ;
413+
414+table_one_two:
415+ table1 | table1 | table1 | table2 | table2 ;
416+
417+and_or:
418+ AND | AND | OR ;
419+
420+or_and:
421+ OR | OR | OR | AND ;
422+
423+not:
424+ | | NOT ;
425+
426
427=== added file 'conf/range_access_drizzle.zz'
428--- conf/range_access_drizzle.zz 1970-01-01 00:00:00 +0000
429+++ conf/range_access_drizzle.zz 2010-01-31 04:22:11 +0000
430@@ -0,0 +1,17 @@
431+$tables = {
432+ names => ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', 'AA', 'BB', 'CC', 'DD', 'EE', 'FF', 'GG', 'HH', 'II', 'JJ', 'KK', 'LL', 'MM', 'NN', 'OO', 'PP'],
433+ rows => [0, 1, 10, 20, 25, 50, , 75, 100],
434+ engines => [ 'Innodb' ]
435+};
436+
437+$fields = {
438+ types => [ 'int', 'varchar(10)', 'varchar(1024)' , 'date' , 'datetime'],
439+ indexes => [undef, 'key' ],
440+ null => [undef ],
441+ charsets => ['utf8']
442+};
443+
444+$data => {
445+ numbers => [ 'digit', 'null', undef ],
446+ strings => [ 'letter', 'english' , 'string(1024)', 'quid' ]
447+};