1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge MySQL 5.1.46 into MariaDB.

Still two test failures to be solved: main.myisam and main.subselect.
This commit is contained in:
unknown
2010-04-28 14:52:24 +02:00
1343 changed files with 951110 additions and 3875 deletions

View File

@ -357,11 +357,14 @@ sub post_check_client_group {
if (IS_WINDOWS)
{
# Shared memory base may or may not be defined (e.g not defined in embedded)
my $shm = $group_to_copy_from->option("shared-memory-base-name");
if (defined $shm)
if (! $self->{ARGS}->{embedded})
{
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
# Shared memory base may or may not be defined (e.g not defined in embedded)
my $shm = $group_to_copy_from->option("shared-memory-base-name");
if (defined $shm)
{
$config->insert($client_group_name,"shared-memory-base-name", $shm->value());
}
}
}
}

View File

@ -81,24 +81,28 @@ sub is_child {
}
# Find the safe process binary or script
my @safe_process_cmd;
my $safe_kill;
if (IS_WIN32PERL or IS_CYGWIN){
# Use my_safe_process.exe
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Find the safe process binary or script
sub find_bin {
if (IS_WIN32PERL or IS_CYGWIN)
{
# Use my_safe_process.exe
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
# Use my_safe_kill.exe
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
}
else
{
# Use my_safe_process
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
"my_safe_process");
push(@safe_process_cmd, $exe);
}
}
@ -183,63 +187,6 @@ sub run {
return $proc->exit_status();
}
#
# Start a process that returns after "duration" seconds
# or when it's parent process does not exist anymore
#
sub timer {
my $class= shift;
my $duration= shift or croak "duration required";
my $parent_pid= $$;
my $pid= My::SafeProcess::Base::_safe_fork();
if ($pid){
# Parent
my $proc= bless
({
SAFE_PID => $pid,
SAFE_NAME => "timer",
PARENT => $$,
}, $class);
# Put the new process in list of running
$running{$pid}= $proc;
return $proc;
}
# Child, install signal handlers and sleep for "duration"
$SIG{INT}= 'IGNORE';
$SIG{TERM}= sub {
#print STDERR "timer $$: woken up, exiting!\n";
exit(0);
};
$0= "safe_timer($duration)";
if (IS_WIN32PERL){
# Just a thread in same process
sleep($duration);
print STDERR "timer $$: expired after $duration seconds\n";
exit(0);
}
my $count_down= $duration;
while($count_down--){
# Check that parent is still alive
if (kill(0, $parent_pid) == 0){
#print STDERR "timer $$: parent gone, exiting!\n";
exit(0);
}
sleep(1);
}
print STDERR "timer $$: expired after $duration seconds\n";
exit(0);
}
#
# Shutdown process nicely, and wait for shutdown_timeout seconds
# If processes hasn't shutdown, kill them hard and wait for return
@ -338,12 +285,12 @@ sub start_kill {
$ret= system($safe_kill, $winpid) >> 8;
if ($ret == 3){
print "Couldn't open the winpid: $winpid ",
print "Couldn't open the winpid: $winpid ".
"for pid: $pid, try one more time\n";
sleep(1);
$winpid= _winpid($pid);
$ret= system($safe_kill, $winpid) >> 8;
print "Couldn't open the winpid: $winpid ",
print "Couldn't open the winpid: $winpid ".
"for pid: $pid, continue and see what happens...\n";
}
}
@ -543,6 +490,40 @@ sub wait_any {
}
#
# Wait for any process to exit, or a timeout
#
# Returns a reference to the SafeProcess that
# exited or a pseudo-process with $proc->{timeout} == 1
#
sub wait_any_timeout {
my $class= shift;
my $timeout= shift;
my $proc;
my $millis=10;
do {
::mtr_milli_sleep($millis);
# Slowly increse interval up to max. 1 second
$millis++ if $millis < 1000;
# Return a "fake" process for timeout
if (::has_expired($timeout)) {
$proc= bless
({
SAFE_PID => 0,
SAFE_NAME => "timer",
timeout => 1,
}, $class);
} else {
$proc= check_any();
}
} while (! $proc);
return $proc;
}
#
# Wait for all processes to exit
#
@ -600,7 +581,7 @@ sub self2str {
sub _verbose {
return unless $_verbose;
print STDERR " ## ", @_, "\n";
print STDERR " ## ". @_. "\n";
}

View File

@ -186,14 +186,20 @@ int main(int argc, const char** argv )
die("No real args -> nothing to do");
/* Copy the remaining args to child_arg */
for (int j= i+1; j < argc; j++) {
if (strchr (argv[j], ' ')) {
/* Protect with "" if this arg contains a space */
to+= _snprintf(to, child_args + sizeof(child_args) - to,
"\"%s\" ", argv[j]);
} else {
to+= _snprintf(to, child_args + sizeof(child_args) - to,
"%s ", argv[j]);
}
arg= argv[j];
if (strchr (arg, ' ') &&
arg[0] != '\"' &&
arg[strlen(arg)] != '\"')
{
/* Quote arg that contains spaces and are not quoted already */
to+= _snprintf(to, child_args + sizeof(child_args) - to,
"\"%s\" ", arg);
}
else
{
to+= _snprintf(to, child_args + sizeof(child_args) - to,
"%s ", arg);
}
}
break;
} else {

View File

@ -40,7 +40,6 @@ our $default_storage_engine;
our $opt_with_ndbcluster_only;
our $defaults_file;
our $defaults_extra_file;
our $reorder= 1;
our $quick_collect;
sub collect_option {
@ -99,7 +98,8 @@ sub init_pattern {
#
##############################################################################
sub collect_test_cases ($$) {
sub collect_test_cases ($$$) {
my $opt_reorder= shift; # True if we're reordering tests
my $suites= shift; # Semicolon separated list of test suites
my $opt_cases= shift;
my $cases= []; # Array of hash(one hash for each testcase)
@ -118,10 +118,16 @@ sub collect_test_cases ($$) {
!(IS_WINDOWS && $::opt_embedded_server) &&
$lib_innodb_plugin);
foreach my $suite (split(",", $suites))
# If not reordering, we also shouldn't group by suites, unless
# no test cases were named.
# This also effects some logic in the loop following this.
if ($opt_reorder or !@$opt_cases)
{
push(@$cases, collect_one_suite($suite, $opt_cases));
last if $some_test_found;
foreach my $suite (split(",", $suites))
{
push(@$cases, collect_one_suite($suite, $opt_cases));
last if $some_test_found;
}
}
if ( @$opt_cases )
@ -135,6 +141,7 @@ sub collect_test_cases ($$) {
my ($sname, $tname, $extension)= split_testname($test_name_spec);
foreach my $test ( @$cases )
{
last unless $opt_reorder;
# test->{name} is always in suite.name format
if ( $test->{name} =~ /.*\.$tname/ )
{
@ -144,12 +151,13 @@ sub collect_test_cases ($$) {
}
if ( not $found )
{
$sname= "main" if !$opt_reorder and !$sname;
mtr_error("Could not find '$tname' in '$suites' suite(s)") unless $sname;
# If suite was part of name, find it there
my ($this_case) = collect_one_suite($sname, [ $tname ]);
if ($this_case)
# If suite was part of name, find it there, may come with combinations
my @this_case = collect_one_suite($sname, [ $tname ]);
if (@this_case)
{
push (@$cases, $this_case);
push (@$cases, @this_case);
}
else
{
@ -159,7 +167,7 @@ sub collect_test_cases ($$) {
}
}
if ( $reorder && !$quick_collect)
if ( $opt_reorder && !$quick_collect)
{
# Reorder the test cases in an order that will make them faster to run
my %sort_criteria;
@ -528,6 +536,9 @@ sub collect_one_suite
next if ($test->{'name'} eq 'main.innodb-autoinc');
# Fails with innodb plugin: r6185 Testcases changes not included
next if ($test->{'name'} eq 'main.innodb_bug44369');
# Fix for BUG47621 is not in InnoDB plugin
next if ($test->{'name'} eq 'main.innodb_bug21704');
next if ($test->{'name'} eq 'main.innodb_bug47621');
# Copy test options
my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test))

View File

@ -20,43 +20,20 @@
use strict;
# These are not to be prefixed with "mtr_"
sub gprof_collect ($@) {
my ($exe_mysqld, @gprof_dirs)= @_;
sub gprof_prepare ();
sub gprof_collect ();
print ("Collecting gprof reports.....\n");
##############################################################################
#
#
#
##############################################################################
sub gprof_prepare () {
rmtree($::opt_gprof_dir);
mkdir($::opt_gprof_dir);
}
# FIXME what about master1 and slave1?!
sub gprof_collect () {
if ( -f "$::master->[0]->{'path_myddir'}/gmon.out" )
foreach my $datadir (@gprof_dirs)
{
# FIXME check result code?!
mtr_run("gprof",
[$::exe_master_mysqld,
"$::master->[0]->{'path_myddir'}/gmon.out"],
$::opt_gprof_master, "", "", "");
print "Master execution profile has been saved in $::opt_gprof_master\n";
}
if ( -f "$::slave->[0]->{'path_myddir'}/gmon.out" )
{
# FIXME check result code?!
mtr_run("gprof",
[$::exe_slave_mysqld,
"$::slave->[0]->{'path_myddir'}/gmon.out"],
$::opt_gprof_slave, "", "", "");
print "Slave execution profile has been saved in $::opt_gprof_slave\n";
my $gprof_msg= "$datadir/gprof.msg";
my $gprof_err= "$datadir/gprof.err";
if ( -f "$datadir/gmon.out" )
{
system("gprof $exe_mysqld $datadir/gmon.out 2>$gprof_err >$gprof_msg");
print ("GPROF output in $gprof_msg, errors in $gprof_err\n");
}
}
}

View File

@ -30,7 +30,9 @@ sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
##############################################################################
#
@ -167,7 +169,7 @@ sub mtr_exe_exists (@) {
}
sub mtr_milli_sleep {
sub mtr_milli_sleep ($) {
die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
my ($millis)= @_;
@ -194,4 +196,11 @@ sub mtr_wait_lock_file {
return ($waited);
}
# Simple functions to start and check timers (have to be actively polled)
# Timer can be "killed" by setting it to 0
sub start_timer ($) { return time + $_[0]; }
sub has_expired ($) { return $_[0] && time gt $_[0]; }
1;

View File

@ -69,7 +69,7 @@ sub _mtr_report_test_name ($) {
$tname.= " '$tinfo->{combination}'"
if defined $tinfo->{combination};
print _name(), _timestamp();
print _name(). _timestamp();
printf "%-40s ", $tname;
my $worker = $tinfo->{worker};
printf "w$worker " if $worker;
@ -222,7 +222,8 @@ sub mtr_report_test ($) {
}
sub mtr_report_stats ($$$) {
sub mtr_report_stats ($$$$) {
my $prefix= shift;
my $fail= shift;
my $tests= shift;
my $extra_warnings= shift;
@ -328,6 +329,9 @@ sub mtr_report_stats ($$$) {
}
}
# Print summary line prefix
print "$prefix: ";
# Print a list of testcases that failed
if ( $tot_failed != 0 )
{
@ -404,13 +408,13 @@ MSG
##############################################################################
sub mtr_print_line () {
print '-' x 60, "\n";
print '-' x 60 . "\n";
}
sub mtr_print_thick_line {
my $char= shift || '=';
print $char x 78, "\n";
print $char x 78 . "\n";
}
@ -468,7 +472,7 @@ sub _timestamp {
# Always print message to screen
sub mtr_print (@) {
print _name(), join(" ", @_), "\n";
print _name(). join(" ", @_). "\n";
}
@ -476,22 +480,22 @@ sub mtr_print (@) {
sub mtr_report (@) {
if (defined $verbose)
{
print _name(), join(" ", @_), "\n";
print _name(). join(" ", @_). "\n";
}
}
# Print warning to screen
sub mtr_warning (@) {
print STDERR _name(), _timestamp(),
"mysql-test-run: WARNING: ", join(" ", @_), "\n";
print STDERR _name(). _timestamp().
"mysql-test-run: WARNING: ". join(" ", @_). "\n";
}
# Print error to screen and then exit
sub mtr_error (@) {
print STDERR _name(), _timestamp(),
"mysql-test-run: *** ERROR: ", join(" ", @_), "\n";
print STDERR _name(). _timestamp().
"mysql-test-run: *** ERROR: ". join(" ", @_). "\n";
if (IS_WINDOWS)
{
POSIX::_exit(1);
@ -506,8 +510,8 @@ sub mtr_error (@) {
sub mtr_debug (@) {
if ( $verbose > 2 )
{
print STDERR _name(),
_timestamp(), "####: ", join(" ", @_), "\n";
print STDERR _name().
_timestamp(). "####: ". join(" ", @_). "\n";
}
}
@ -515,8 +519,8 @@ sub mtr_debug (@) {
sub mtr_verbose (@) {
if ( $verbose )
{
print STDERR _name(), _timestamp(),
"> ",join(" ", @_),"\n";
print STDERR _name(). _timestamp().
"> ".join(" ", @_)."\n";
}
}
@ -526,8 +530,8 @@ sub mtr_verbose_restart (@) {
my $proc= $server->{proc};
if ( $verbose_restart )
{
print STDERR _name(),_timestamp(),
"> Restart $proc - ",join(" ", @args),"\n";
print STDERR _name()._timestamp().
"> Restart $proc - ".join(" ", @args)."\n";
}
}

View File

@ -150,7 +150,7 @@ sub run_stress_test ()
mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--cleanup");
mtr_add_arg($args, "--log-error-details");
mtr_add_arg($args, "--abort-on-error");
mtr_add_arg($args, "--abort-on-error=1");
if ( $::opt_stress_init_file )
{

View File

@ -150,7 +150,7 @@ sub run_stress_test ()
mtr_add_arg($args, "--verbose");
mtr_add_arg($args, "--cleanup");
mtr_add_arg($args, "--log-error-details");
mtr_add_arg($args, "--abort-on-error");
mtr_add_arg($args, "--abort-on-error=1");
if ( $::opt_stress_init_file )
{

View File

@ -920,6 +920,11 @@ sub command_line_setup () {
mtr_report("Using default engine '$used_default_engine'")
if defined $used_default_engine;
if ($glob_win32 and defined $opt_mem) {
mtr_report("--mem not supported on Windows, ignored");
$opt_mem= undef;
}
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
# --------------------------------------------------------------------------