RandomQueryGeneratorQuickStart

David Bennett edited this page Jul 23, 2014 · 16 revisions

Table of Contents

About

The Random Query Generator is a tool for testing the MySQL server by means of randomly generated data and queries. Both the data and the queries are highly configurable and various different scenarios can be tested. More information is available here.

Platforms

Linux, Solaris, Windows (ActiveState Perl and Cygwin) and OS X are known to work.

Downloading

 $ bzr branch lp:randgen

Prerequisites

1. DBD::mysql perl module

Important: Version 4.004 or newer is required for some RQG features (mysql_multi_statement support).

Fedora/RedHat:

 $ sudo yum install perl-DBD-mysql

Ubuntu:

 http://packages.ubuntu.com/jaunty/libdbd-mysql-perl

Linux generic / OS X:

Important: for this command you will need to install CPAN first, see CPAN instructions in point 3 below

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

OS X with MacPorts:

 $ sudo port install DBD::mysql

Important: This will likely result in 2 versions of perl on your system - one in /opt/local which can cause problem.
The CPAN install method works well and should be recommended if you don't want to use MacPorts (or similar software)

ActiveState Perl 5.6

 c:\>ppm install http://theoryx5.uwinnipeg.ca/ppmpackages/DBD-mysql.ppd

ActiveState Perl 5.8

 c:\>ppm install http://theoryx5.uwinnipeg.ca/ppms/DBD-mysql.ppd

ActiveState Perl 5.10

 c:\>ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/DBD-mysql.ppd

2. GNU tools for Windows

3. CPAN

Important: This is a prerequisite to installing any CPAN modules below, or to installing DBD::mysql above using the CPAN method.

Fedora/RedHat:

 $ sudo yum install cpan                       /OR/
 $ sudo yum install perl-CPAN

4. Perl modules

Sidenote: you can also use

 $ sudo perl -MCPAN -e "shell"

To invoke a shell, and then use install <module></module> (ref module names below) at the shell's (cpan) prompt to install the various modules listed below. This is usually a much easier and quicker way to install all modules. Example of how this works, including a check to see if things went correctly:

  $ sudo perl -MCPAN -e "shell"
  cpan[1]> install Test::More Digest::MD5 Log::Log4perl XML::Writer DBIx::MyParsePP Statistics::Descriptive JSON Test::Unit 
  [...]
  cpan[2]> install Test::More Digest::MD5 Log::Log4perl XML::Writer DBIx::MyParsePP Statistics::Descriptive JSON Test::Unit
  Test::More is up to date (0.98).
  Digest::MD5 is up to date (2.53).
  Log::Log4perl is up to date (1.42).
  XML::Writer is up to date (0.623).
  DBIx::MyParsePP is up to date (0.50).
  Statistics::Descriptive is up to date (3.0605).
  JSON is up to date (2.59).
  Test::Unit is up to date (0.25).

4.1. Test::More Perl module (prerequisite to installing DBIx::MyParsePP below)

 $ sudo perl -MCPAN -e 'install Test::More'

4.2. Digest::MD5 Perl module (required for running gentest?)

 $ sudo perl -MCPAN -e 'install Digest::MD5'

4.3. Log::Log4perl module (required for properly printing things, for example in ErrorLogAlarm)

 $ sudo perl -MCPAN -e 'install Log::Log4perl'

4.4. (Optional) XML::Writer Perl module

Only required if you want the RQG to generate XML reports from your test runs (option &#45;&#45;xml&#45;output&#61;your_filename).

The module has no extra non-core dependencies and can be installed via CPAN or ppm.

 $ sudo perl -MCPAN -e 'install XML::Writer'

4.5. (Optional) DBIx::MyParsePP Perl module

Only required for automatic bug simplification, such as the util/simplify&#42; scripts and the ResultsetComparatorSimplify Validator

 $ sudo perl -MCPAN -e 'install DBIx::MyParsePP'

4.6. (Optional) Statistics::Descriptive Perl module

Only required if you want to use the ExecutionTimeComparator validator with extended statistical qualification of results.

If the module is not installed, the validator will still work, but possibly with reduced functionality (depending on settings). Default settings do not require this module.

 $ sudo perl -MCPAN -e 'install Statistics::Descriptive'

4.7. (Optional) JSON Perl module

Only required if you want to use the OptimizerTraceParser validator, which grabs JSON-formatted text from MySQL, validates the syntax and makes a Perl datastructure out of it.

 $ sudo perl -MCPAN -e 'install JSON'

4.8. (Optional) Test::Unit Perl module

Only required to run RQG unit tests (testing the RQG itself). See the file unit/README for details.

 $ sudo perl -MCPAN -e 'install Test::Unit'

Running your first test

  • Against an already running server:
 $ perl gentest.pl \
   --dsn=dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test \
   --gendata=conf/examples/example.zz \
   --grammar=conf/examples/example.yy
  • Against a source or binary distribution:
 $ perl runall.pl \
   --basedir=/path/to/mysql/distribution
   --gendata=conf/examples/example.zz \
   --grammar=conf/examples/example.yy

More information is available here

Category:RandomQueryGenerator

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.