Project

Profile

Help

Random Query Generator

The tool is capable of executing test scenarios that include:

  • Generate a database from a description of the desired data contents and properties;
  • Execute random queries based on SQL templates the queries must conform to;
  • Compare the results returned by different server versions, configurations, or storage engines;
  • Monitor the server during the test and detect deadlocks, crashes, replication failures and other interesting events.

How to install

In this article we describe installing and launching for Ubuntu / Linux generic; see detailed information here: https://github.com/RQG/RQG-Documentation/wiki/RandomQueryGeneratorQuickStart#prerequisites

From Launchpad using Bazaar:
$ bzr branch lp:randgen

perl -MCPAN -e 'install DBD::mysql'

To invoke a shell
sudo perl -MCPAN -e "shell"
and install the various modules

Testing

For your first test run the commands from https://github.com/RQG/RQG-Documentation/wiki/RandomQueryGeneratorQuickStart#Running_your_first_test
All commands must to successful complete.

The following perl scripts are in the directory randgen:

– combinations.pl which generates the many different ways (read ‘trials’) in which RQG is started (using runall.pl) with various options to mysqld etc.
– runall.pl which starts/stops mysqld, does various high-level checking etc. (in other words; ‘a basic RQG run’)
– gentest.pl which is the executor component (iow ‘the actual basic RQG test’)
– gendata.pl which setups the data (tables + data)

1. gentest.pl

perl gentest.pl --dsn=dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test_bd --gendata=conf/examples/example.zz --grammar=conf/examples/example.yy
....
  1. 2016-08-10T14:16:19 Test completed successfully.

2. gensql.pl script generates SQL statements based on a grammar and dumps them to stdout where they can be saved to a file or forwarded to a mysql client for execution. All diagnostic messages by the RQG are prefixed with a # sign and therefore appear as comments in the query stream and will be ignored.

perl gensql.pl --grammar=ex_dt.yy --queries=10 --dsn=dbi:mysql:host=127.0.0.1:port=3306:user=root:database=museums

...
INSERT INTO `table100_key_pk_parts_2_int_autoinc`(`col_set_utf8_not_null`) VALUES (999-00-00 00:00:-10);
....

Script successful completes.

Links

https://github.com/RQG/RQG-Documentation/wiki/Category:RandomQueryGenerator
https://mariadb.com/kb/en/mariadb/rqg-performance-comparisons/