-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Philip Stoev
committed
Jul 24, 2009
0 parents
commit f9853b6
Showing
206 changed files
with
14,174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test : | ||
find t -name '*.t' | xargs -n 1 perl ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
The purpose of this framework is to test the server using queries randomly generated from a config file. | ||
|
||
Wiki: | ||
|
||
* http://forge.mysql.com/wiki/Category:RandomQueryGenerator | ||
|
||
Launchpad homepage: | ||
|
||
* https://launchpad.net/randgen | ||
|
||
Code repository: | ||
|
||
* lp:~randgen/randgen/main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
thread apply all backtrace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
backtrace |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
use strict; | ||
use lib 'lib'; | ||
use lib "$ENV{RQG_HOME}/lib"; | ||
use List::Util 'shuffle'; | ||
use GenTest::Random; | ||
use Getopt::Long; | ||
use Data::Dumper; | ||
|
||
my ($config_file, $basedir, $vardir, $trials, $duration, $grammar, $gendata); | ||
my $seed = 1; | ||
my $combinations; | ||
my %results; | ||
my @commands; | ||
my $max_result = 0; | ||
|
||
my $opt_result = GetOptions( | ||
'config=s' => \$config_file, | ||
'basedir=s' => \$basedir, | ||
'vardir=s' => \$vardir, | ||
'trials=i' => \$trials, | ||
'duration=i' => \$duration, | ||
'seed=s' => \$seed, | ||
'grammar=s' => \$grammar, | ||
'gendata=s' => \$gendata | ||
); | ||
|
||
my $prng = GenTest::Random->new( | ||
seed => $seed eq 'time' ? time() : $seed | ||
); | ||
|
||
open(CONF, $config_file) or die "unable to open config file '$config_file': $!"; | ||
read(CONF, my $config_text, -s $config_file); | ||
eval ($config_text); | ||
die "Unable to load $config_file: $@" if $@; | ||
|
||
my $comb_count = $#$combinations + 1; | ||
|
||
foreach my $trial_id (1..$trials) { | ||
my @comb; | ||
foreach my $comb_id (0..($comb_count-1)) { | ||
$comb[$comb_id] = $combinations->[$comb_id]->[$prng->uint16(0, $#{$combinations->[$comb_id]})]; | ||
} | ||
|
||
my $comb_str = join(' ', @comb); | ||
|
||
my $mask = $prng->uint16(0, 65535); | ||
|
||
my $command = " | ||
perl runall.pl $comb_str | ||
--mask=$mask | ||
--queries=100000000 | ||
"; | ||
|
||
$command .= " --duration=$duration" if $duration ne ''; | ||
$command .= " --basedir=$basedir " if $basedir ne ''; | ||
$command .= " --gendata=$gendata " if $gendata ne ''; | ||
$command .= " --grammar=$grammar " if $grammar ne ''; | ||
$command .= " --seed=$seed " if $seed ne ''; | ||
|
||
$command .= " --vardir=$vardir/current " if $command !~ m{--mem}sio && $vardir ne ''; | ||
$command =~ s{[\t\r\n]}{ }sgio; | ||
$command .= " 2>&1 | tee $vardir/trial".$trial_id.'.log'; | ||
|
||
$commands[$trial_id] = $command; | ||
|
||
$command =~ s{"}{\\"}sgio; | ||
$command = 'bash -c "set -o pipefail; '.$command.'"'; | ||
|
||
print localtime()." [$$] $command\n"; | ||
my $result = system($command); | ||
print localtime()." [$$] runall.pl exited with exit status ".($result >> 8)."\n"; | ||
|
||
if ($result > 0) { | ||
$max_result = $result >> 8 if ($result >> 8) > $max_result; | ||
print localtime()." [$$] Copying vardir to $vardir/vardir".$trial_id."\n"; | ||
if ($command =~ m{--mem}) { | ||
system("cp -r /dev/shm/var $vardir/vardir".$trial_id); | ||
} else { | ||
system("cp -r $vardir/current $vardir/vardir".$trial_id); | ||
} | ||
open(OUT, ">$vardir/vardir".$trial_id."/command"); | ||
print OUT $command; | ||
close(OUT); | ||
} | ||
$results{$result >> 8}++; | ||
} | ||
|
||
print localtime()." [$$] Summary of various interesting strings from the logs:\n"; | ||
print Dumper \%results; | ||
foreach my $string ('text=', 'bugcheck', 'Error: assertion', 'mysqld got signal', 'exception') { | ||
system("grep -i '$string' $vardir/trial*log"); | ||
} | ||
|
||
print localtime()." [$$] $0 will exit with exit status $max_result\n"; | ||
exit($max_result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
package GenTest::Reporter::RecoveryConsistency; | ||
|
||
require Exporter; | ||
@ISA = qw(GenTest::Reporter); | ||
|
||
use strict; | ||
use DBI; | ||
use GenTest; | ||
use GenTest::Constants; | ||
use GenTest::Reporter; | ||
|
||
sub monitor { | ||
my $reporter = shift; | ||
my $pid = $reporter->serverInfo('pid'); | ||
|
||
if (time() > $reporter->testEnd() - 10) { | ||
say("Sending SIGKILL to mysqld with pid $pid in order to force a recovery."); | ||
kill(9, $pid); | ||
return STATUS_SERVER_KILLED; | ||
} else { | ||
return STATUS_OK; | ||
} | ||
} | ||
|
||
sub report { | ||
my $reporter = shift; | ||
my $binary = $reporter->serverInfo('binary'); | ||
my $language = $reporter->serverVariable('language'); | ||
my $datadir = $reporter->serverVariable('datadir'); | ||
$datadir =~ s{[\\/]$}{}sgio; | ||
my $recovery_datadir = $datadir.'_recovery'; | ||
my $socket = $reporter->serverVariable('socket'); | ||
my $port = $reporter->serverVariable('port'); | ||
my $pid = $reporter->serverInfo('pid'); | ||
|
||
say("Sending SIGKILL to mysqld with pid $pid in order to force a recovery."); | ||
kill(9, $pid); | ||
sleep(10); | ||
|
||
system("cp -r $datadir $recovery_datadir"); | ||
|
||
say("Attempting database recovery..."); | ||
|
||
my @mysqld_options = ( | ||
'--no-defaults', | ||
'--core-file', | ||
'--loose-console', | ||
'--loose-falcon-debug-mask=65535', | ||
'--language='.$language, | ||
'--datadir="'.$recovery_datadir.'"', | ||
'--socket="'.$socket.'"', | ||
'--port='.$port | ||
); | ||
|
||
my $mysqld_command = $binary.' '.join(' ', @mysqld_options).' 2>&1'; | ||
say("Executing $mysqld_command ."); | ||
|
||
open(MYSQLD, "$mysqld_command|"); | ||
my $recovery_status = STATUS_OK; | ||
while (<MYSQLD>) { | ||
$_ =~ s{[\r\n]}{}siog; | ||
say($_); | ||
if ($_ =~ m{exception}sio) { | ||
$recovery_status = STATUS_DATABASE_CORRUPTION; | ||
} elsif ($_ =~ m{ready for connections}sio) { | ||
say("Server Recovery was apparently successfull.") if $recovery_status == STATUS_OK ; | ||
last; | ||
} elsif ($_ =~ m{got signal}sio) { | ||
$recovery_status = STATUS_DATABASE_CORRUPTION; | ||
|
||
} | ||
} | ||
|
||
say("Checking database consistency..."); | ||
my $dbh = DBI->connect($reporter->dsn()); | ||
|
||
my $tables = $dbh->selectcol_arrayref("SHOW TABLES"); | ||
|
||
foreach my $table (@$tables) { | ||
my $average = $dbh->selectrow_array(" | ||
SELECT (SUM(`int_key`) + SUM(`int`)) / COUNT(*) | ||
FROM `$table` | ||
"); | ||
|
||
if ($average ne '200.0000') { | ||
say("Bad average on table: $table; average: $average"); | ||
$recovery_status = STATUS_DATABASE_CORRUPTION; | ||
} else { | ||
say("Average is $average"); | ||
} | ||
} | ||
|
||
say("Shutting down the recovered server..."); | ||
|
||
if (not defined $dbh) { | ||
$recovery_status = STATUS_DATABASE_CORRUPTION; | ||
} else { | ||
$dbh->func('shutdown', 'admin'); | ||
} | ||
|
||
close(MYSQLD); | ||
|
||
if ($recovery_status > STATUS_OK) { | ||
say("Recovery has failed."); | ||
} | ||
|
||
return $recovery_status; | ||
} | ||
|
||
sub type { | ||
return REPORTER_TYPE_CRASH | REPORTER_TYPE_DEADLOCK | REPORTER_TYPE_SUCCESS | REPORTER_TYPE_PERIODIC | REPORTER_TYPE_SERVER_KILLED; | ||
} | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# WL#5004 Comprehensive Locking Stress Test for Azalea | ||
# | ||
# Grammar for generation of templates of testing objects | ||
# | ||
# This is a prototype which means it might be incomplete and contain errors. | ||
# | ||
# General architecture rule: | ||
# We | ||
# - work on copies of the objects created via gendata.pl | ||
# - do not modify the objects via gendata.pl | ||
# | ||
|
||
$tables = { | ||
rows => [0, 1, 10 ] | ||
# partitions => [ undef , 'KEY (pk) PARTITIONS 2' ] | ||
}; | ||
|
||
$fields = { | ||
types => [ 'int', 'char', 'enum', 'set' ], | ||
indexes => [undef, 'key' ], | ||
null => [undef, 'not null'], | ||
default => [undef, 'default null'], | ||
sign => [undef, 'unsigned'], | ||
charsets => ['utf8', 'latin1'] | ||
}; | ||
|
||
$data = { | ||
numbers => [ 'digit', 'null', undef ], | ||
strings => [ 'letter', 'english' ], | ||
blobs => [ 'data' ], | ||
temporals => ['date', 'year', 'null', undef ] | ||
} |
Oops, something went wrong.