-
Notifications
You must be signed in to change notification settings - Fork 20
RandomQueryGeneratorGrammarMaskingAndRedefinition
The Random Query Generator's main scripts (runall.pl and gentest.pl) support a --mask parameter that can be used to specify that only certain portions of the grammar should be exercised. It takes the sub-elements of the top-level query element and --mask-level levels (default 1) down in the rule hierarchy and filters them out.
--mask is a seed to an infinite random bit-mask.
The intended use of this option is to do numerous test runs with variousvalues for --mask in order to achieve various workloads using the same SQL grammar.
For example, the following grammar:
query: select | insert | update | delete ; ...
, when executed with --mask=someseed and the random value (first 16 bits) happen to be 5, will only run select and update queries (in a 50/50 proportion) because 5 decimal is 0101 binary.
In case of mask-level = 0 or mask = 0 no masking gets applied.
In case of masking gets applied grammar constructs like
dml_list: safety_check dml | safety_check dml ; dml_list ;
could degenerate to something like
dml_list: safety_check dml ; dml_list ;
and cause that RQG aborts with errors like
Rule safety_check occured more than 500 times. Possible endless loop in grammar. Aborting. ... Test completed with failure status 34.
Workaround:
To execute variants of a grammar, one may use --redefine to specify another grammar file that redefines and/or adds rules to the grammar. Consider the following files.
a.yy:
query: select | insert | update | delete ; select: ... ; insert: ....; delete: ....;
and b.yy:
query: select | update | show ; show: .... ;
when gentest.pl or runall.pl is executed withe the options --grammar=a.yy --redefine=b.yy you will get a run where query has been redefined and show has been added.