Category: RandomQueryGenerator

RandomQueryGeneratorValidators


Contents

[edit] Validators Overview

The Validators are individual modules that perform extra checking on the queries being executed. They are enabled via the --validators=Validator1,Validator2,ValidatorN option. By default, ResultsetComparator is enabled when running the same queries against two servers and ResultsetComparator is enabled when replication is being tested.

[edit] Available Validators

[edit] Optimizer, Comparison Testing and Data Validation

Comparing between two different binaries:

--basedir1=/path/to/server1/
--basedir2=/path/to/server2/
--validator=ResultsetComparator

Comparing between two different configurations:

--basedit=/path/to/server/
--mysqld1=--option1=value1 --mysqld1=--option2=value2
--mysqld2=--option3=value3 --mysqld1=--option4=value4

Comparisons involving two or more different products -- see RandomQueryGenerator3WayDBComparision


[edit] Database Corruption

[edit] Replication

[edit] Transactional Consistency

[edit] Performance

[edit] Grammar and Test Debugging

[edit] Validator API

Each Validator is a module residing in lib/GenTest/Validator , having the following header:

package GenTest::Validator::YOUR_VALIDATOR_NAME_HERE;

require Exporter;
@ISA = qw(GenTest::Validator GenTest);

use strict;
use GenTest::Constants;
use GenTest::Result;
use GenTest::Validator;
use GenTest::Executor;

and implementing the validate() method:

sub validate {
  my ($validator, $executors, $results) = @_;

  if ($results->[0]->query() ~= m{i_like_this_query}sio ) {
    return STATUS_OK;
  } else {
    return STATUS_DATABASE_CORRUPTION;
  }
}

$validator is a reference to self, $executors is a reference to an array of Executor objects, one per server, and $results is a reference to an array of Result, containing all information about the query being validated and its result set, as returned by each server.


The validate() method can return any of the STATUS_* constants listed in lib/GenTest/Constant.pm. STATUS_OK is used to report that the Validator is OK with the particular query (which is then passed to the next Validator), STATUS_WONT_HANDLE is used to report that the Validator is not interested in providing an opinion about this particular query, and STATUS_SKIP is used to signal that the query should not be processed further by any other Validator. You can also return STATUS_EOF to cause the test to terminate immediately without prejudice.


The rest of the error codes are either non-fatal and will allow the test to continue or fatal, aborting the test immediately. Use a non-fatal error code if it will be useful to continue the test and collect more test failures for examination, but where the consistency of the database has not been compromised and future test failures will not be caused by the initial failure. For example, if you are running queries against two servers and they report different error codes, that would be appropriately a fatal error, since the databases may have diverged, making further comparisons with more queries questionable.


Note that RQG objects, including Validators, are not classical Perl hashes. They are arrays, and the constructor is provided by lib/GenTest.pm.

Retrieved from "http://forge.mysql.com/wiki/RandomQueryGeneratorValidators"

This page has been accessed 1,558 times. This page was last modified 08:48, 27 April 2011.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...