Commit 74af1995 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

Merge neptunus.(none):/home/msvensson/mysql/mysqltestrun_faster/my50-mysqltestrun_faster

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
parents 16edce1e 0e9e1f2c
...@@ -252,6 +252,26 @@ sub collect_one_test_case($$$$$$$) { ...@@ -252,6 +252,26 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'slave_restart'}= 1; $tinfo->{'slave_restart'}= 1;
} }
# Cluster is needed by test case if testname contains ndb
if ( ( $::opt_with_ndbcluster or $::glob_use_running_ndbcluster ) and
defined mtr_match_substring($tname,"ndb") )
{
if ( $::opt_skip_ndbcluster )
{
$tinfo->{'ndb_test'}= 0;
$tinfo->{'skip'}= 1;
return;
}
else
{
$tinfo->{'ndb_test'}= 1;
}
}
else
{
$tinfo->{'ndb_test'}= 0;
}
# FIXME what about embedded_server + ndbcluster, skip ?! # FIXME what about embedded_server + ndbcluster, skip ?!
my $master_opt_file= "$testdir/$tname-master.opt"; my $master_opt_file= "$testdir/$tname-master.opt";
......
...@@ -50,6 +50,23 @@ sub mtr_match_extension ($$) { ...@@ -50,6 +50,23 @@ sub mtr_match_extension ($$) {
} }
# Match a substring anywere in a string
sub mtr_match_substring ($$) {
my $string= shift;
my $substring= shift;
if ( $string =~ /(.*)\Q$substring\E(.*)$/ ) # strncmp
{
return $1;
}
else
{
return undef; # NULL
}
}
sub mtr_match_any_exact ($$) { sub mtr_match_any_exact ($$) {
my $string= shift; my $string= shift;
my $mlist= shift; my $mlist= shift;
......
...@@ -28,7 +28,7 @@ sub run_stress_test () ...@@ -28,7 +28,7 @@ sub run_stress_test ()
if ( ! $::glob_use_embedded_server and ! $::opt_local_master ) if ( ! $::glob_use_embedded_server and ! $::opt_local_master )
{ {
$::master->[0]->{'pid'}= mysqld_start('master',0,[],[]); $::master->[0]->{'pid'}= mysqld_start('master',0,[],[],0);
if ( ! $::master->[0]->{'pid'} ) if ( ! $::master->[0]->{'pid'} )
{ {
mtr_error("Can't start the mysqld server"); mtr_error("Can't start the mysqld server");
......
...@@ -144,6 +144,8 @@ our $glob_use_running_ndbcluster= 0; ...@@ -144,6 +144,8 @@ our $glob_use_running_ndbcluster= 0;
our $glob_use_embedded_server= 0; our $glob_use_embedded_server= 0;
our @glob_test_mode; our @glob_test_mode;
our $using_ndbcluster_master= 0;
our $glob_basedir; our $glob_basedir;
# The total result # The total result
...@@ -323,7 +325,7 @@ sub kill_and_cleanup (); ...@@ -323,7 +325,7 @@ sub kill_and_cleanup ();
sub check_ssl_support (); sub check_ssl_support ();
sub check_ndbcluster_support (); sub check_ndbcluster_support ();
sub ndbcluster_install (); sub ndbcluster_install ();
sub ndbcluster_start (); sub ndbcluster_start ($);
sub ndbcluster_stop (); sub ndbcluster_stop ();
sub run_benchmarks ($); sub run_benchmarks ($);
sub run_tests (); sub run_tests ();
...@@ -333,8 +335,8 @@ sub run_testcase ($); ...@@ -333,8 +335,8 @@ sub run_testcase ($);
sub report_failure_and_restart ($); sub report_failure_and_restart ($);
sub do_before_start_master ($$); sub do_before_start_master ($$);
sub do_before_start_slave ($$); sub do_before_start_slave ($$);
sub mysqld_start ($$$$); sub mysqld_start ($$$$$);
sub mysqld_arguments ($$$$$); sub mysqld_arguments ($$$$$$);
sub stop_masters_slaves (); sub stop_masters_slaves ();
sub stop_masters (); sub stop_masters ();
sub stop_slaves (); sub stop_slaves ();
...@@ -391,11 +393,11 @@ sub main () { ...@@ -391,11 +393,11 @@ sub main () {
if ( $opt_start_dirty ) if ( $opt_start_dirty )
{ {
if ( ndbcluster_start() ) if ( ndbcluster_start($opt_with_ndbcluster) )
{ {
mtr_error("Can't start ndbcluster"); mtr_error("Can't start ndbcluster");
} }
if ( mysqld_start('master',0,[],[]) ) if ( mysqld_start('master',0,[],[],$using_ndbcluster_master) )
{ {
mtr_report("Servers started, exiting"); mtr_report("Servers started, exiting");
} }
...@@ -1183,6 +1185,7 @@ sub kill_running_server () { ...@@ -1183,6 +1185,7 @@ sub kill_running_server () {
mkpath("$opt_vardir/log"); # Needed for mysqladmin log mkpath("$opt_vardir/log"); # Needed for mysqladmin log
mtr_kill_leftovers(); mtr_kill_leftovers();
$using_ndbcluster_master= 1;
ndbcluster_stop(); ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1; $master->[0]->{'ndbcluster'}= 1;
} }
...@@ -1369,16 +1372,29 @@ sub ndbcluster_install () { ...@@ -1369,16 +1372,29 @@ sub ndbcluster_install () {
return 1; return 1;
} }
$using_ndbcluster_master= 1;
ndbcluster_stop(); ndbcluster_stop();
$master->[0]->{'ndbcluster'}= 1; $master->[0]->{'ndbcluster'}= 1;
return 0; return 0;
} }
sub ndbcluster_start () { sub ndbcluster_start ($) {
my $use_ndbcluster= shift;
if ( ! $opt_with_ndbcluster or $glob_use_running_ndbcluster ) if ( ! $use_ndbcluster )
{ {
$using_ndbcluster_master= 0;
return 0;
}
if ( $glob_use_running_ndbcluster )
{
$using_ndbcluster_master= 1;
return 0;
}
if ( $using_ndbcluster_master )
{
# Master already started
return 0; return 0;
} }
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null # FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
...@@ -1391,13 +1407,14 @@ sub ndbcluster_start () { ...@@ -1391,13 +1407,14 @@ sub ndbcluster_start () {
return 1; return 1;
} }
$using_ndbcluster_master= 1;
return 0; return 0;
} }
sub ndbcluster_stop () { sub ndbcluster_stop () {
if ( ! $using_ndbcluster_master or $glob_use_running_ndbcluster )
if ( ! $opt_with_ndbcluster or $glob_use_running_ndbcluster )
{ {
$using_ndbcluster_master= 0;
return; return;
} }
# FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null # FIXME, we want to _append_ output to file $file_ndb_testrun_log instead of /dev/null
...@@ -1407,6 +1424,7 @@ sub ndbcluster_stop () { ...@@ -1407,6 +1424,7 @@ sub ndbcluster_stop () {
"--stop"], "--stop"],
"", "/dev/null", "", ""); "", "/dev/null", "", "");
$using_ndbcluster_master= 0;
return; return;
} }
...@@ -1424,7 +1442,8 @@ sub run_benchmarks ($) { ...@@ -1424,7 +1442,8 @@ sub run_benchmarks ($) {
if ( ! $glob_use_embedded_server and ! $opt_local_master ) if ( ! $glob_use_embedded_server and ! $opt_local_master )
{ {
$master->[0]->{'pid'}= mysqld_start('master',0,[],[]); $master->[0]->{'pid'}= mysqld_start('master',0,[],[],
$using_ndbcluster_master);
if ( ! $master->[0]->{'pid'} ) if ( ! $master->[0]->{'pid'} )
{ {
mtr_error("Can't start the mysqld server"); mtr_error("Can't start the mysqld server");
...@@ -1772,7 +1791,9 @@ sub run_testcase ($) { ...@@ -1772,7 +1791,9 @@ sub run_testcase ($) {
if ( ! $glob_use_running_server and ! $glob_use_embedded_server ) if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
{ {
if ( $tinfo->{'master_restart'} or if ( $tinfo->{'master_restart'} or
$master->[0]->{'running_master_is_special'} ) $master->[0]->{'running_master_is_special'} or
# Stop if cluster is started but test cases does not need cluster
( $tinfo->{'ndb_test'} != $using_ndbcluster_master ) )
{ {
stop_masters(); stop_masters();
$master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped $master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped
...@@ -1823,7 +1844,11 @@ sub run_testcase ($) { ...@@ -1823,7 +1844,11 @@ sub run_testcase ($) {
{ {
if ( $master->[0]->{'ndbcluster'} ) if ( $master->[0]->{'ndbcluster'} )
{ {
$master->[0]->{'ndbcluster'}= ndbcluster_start(); # Cluster is not started
# Call ndbcluster_start to check if test case needs cluster
# Start it if not already started
$master->[0]->{'ndbcluster'}= ndbcluster_start($tinfo->{'ndb_test'});
if ( $master->[0]->{'ndbcluster'} ) if ( $master->[0]->{'ndbcluster'} )
{ {
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
...@@ -1835,17 +1860,20 @@ sub run_testcase ($) { ...@@ -1835,17 +1860,20 @@ sub run_testcase ($) {
# FIXME not correct location for do_before_start_master() # FIXME not correct location for do_before_start_master()
do_before_start_master($tname,$tinfo->{'master_sh'}); do_before_start_master($tname,$tinfo->{'master_sh'});
$master->[0]->{'pid'}= $master->[0]->{'pid'}=
mysqld_start('master',0,$tinfo->{'master_opt'},[]); mysqld_start('master',0,$tinfo->{'master_opt'},[],
$using_ndbcluster_master);
if ( ! $master->[0]->{'pid'} ) if ( ! $master->[0]->{'pid'} )
{ {
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
return; return;
} }
} }
if ( $opt_with_ndbcluster and ! $master->[1]->{'pid'} ) if ( $using_ndbcluster_master and ! $master->[1]->{'pid'} )
{ {
# Test needs cluster, start an extra mysqld connected to cluster
$master->[1]->{'pid'}= $master->[1]->{'pid'}=
mysqld_start('master',1,$tinfo->{'master_opt'},[]); mysqld_start('master',1,$tinfo->{'master_opt'},[],
$using_ndbcluster_master);
if ( ! $master->[1]->{'pid'} ) if ( ! $master->[1]->{'pid'} )
{ {
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
...@@ -1886,7 +1914,8 @@ sub run_testcase ($) { ...@@ -1886,7 +1914,8 @@ sub run_testcase ($) {
{ {
$slave->[$idx]->{'pid'}= $slave->[$idx]->{'pid'}=
mysqld_start('slave',$idx, mysqld_start('slave',$idx,
$tinfo->{'slave_opt'}, $tinfo->{'slave_mi'}); $tinfo->{'slave_opt'}, $tinfo->{'slave_mi'},
0);
if ( ! $slave->[$idx]->{'pid'} ) if ( ! $slave->[$idx]->{'pid'} )
{ {
report_failure_and_restart($tinfo); report_failure_and_restart($tinfo);
...@@ -2083,12 +2112,13 @@ sub do_before_start_slave ($$) { ...@@ -2083,12 +2112,13 @@ sub do_before_start_slave ($$) {
} }
} }
sub mysqld_arguments ($$$$$) { sub mysqld_arguments ($$$$$$) {
my $args= shift; my $args= shift;
my $type= shift; # master/slave/bootstrap my $type= shift; # master/slave/bootstrap
my $idx= shift; my $idx= shift;
my $extra_opt= shift; my $extra_opt= shift;
my $slave_master_info= shift; my $slave_master_info= shift;
my $using_ndbcluster= shift;
my $sidx= ""; # Index as string, 0 is empty string my $sidx= ""; # Index as string, 0 is empty string
if ( $idx > 0 ) if ( $idx > 0 )
...@@ -2146,10 +2176,16 @@ sub mysqld_arguments ($$$$$) { ...@@ -2146,10 +2176,16 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--skip-innodb", $prefix); mtr_add_arg($args, "%s--skip-innodb", $prefix);
} }
if ( $opt_skip_ndbcluster ) if ( $opt_skip_ndbcluster || !$using_ndbcluster)
{ {
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix); mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
} }
else
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$opt_ndbconnectstring);
}
} }
if ( $type eq 'slave' ) if ( $type eq 'slave' )
...@@ -2226,13 +2262,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -2226,13 +2262,6 @@ sub mysqld_arguments ($$$$$) {
} }
} }
if ( $opt_with_ndbcluster )
{
mtr_add_arg($args, "%s--ndbcluster", $prefix);
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
$opt_ndbconnectstring);
}
# FIXME always set nowdays??? SMALL_SERVER # FIXME always set nowdays??? SMALL_SERVER
mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix); mtr_add_arg($args, "%s--key_buffer_size=1M", $prefix);
mtr_add_arg($args, "%s--sort_buffer=256K", $prefix); mtr_add_arg($args, "%s--sort_buffer=256K", $prefix);
...@@ -2320,11 +2349,13 @@ sub mysqld_arguments ($$$$$) { ...@@ -2320,11 +2349,13 @@ sub mysqld_arguments ($$$$$) {
# #
############################################################################## ##############################################################################
sub mysqld_start ($$$$) { sub mysqld_start ($$$$$) {
my $type= shift; # master/slave/bootstrap my $type= shift; # master/slave/bootstrap
my $idx= shift; my $idx= shift;
my $extra_opt= shift; my $extra_opt= shift;
my $slave_master_info= shift; my $slave_master_info= shift;
my $using_ndbcluster= shift;
my $args; # Arg vector my $args; # Arg vector
my $exe; my $exe;
...@@ -2350,7 +2381,8 @@ sub mysqld_start ($$$$) { ...@@ -2350,7 +2381,8 @@ sub mysqld_start ($$$$) {
valgrind_arguments($args, \$exe); valgrind_arguments($args, \$exe);
} }
mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info); mysqld_arguments($args,$type,$idx,$extra_opt,$slave_master_info,
$using_ndbcluster);
if ( $type eq 'master' ) if ( $type eq 'master' )
{ {
...@@ -2800,7 +2832,7 @@ sub run_mysqltest ($) { ...@@ -2800,7 +2832,7 @@ sub run_mysqltest ($) {
if ( $glob_use_embedded_server ) if ( $glob_use_embedded_server )
{ {
mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[]); mysqld_arguments($args,'master',0,$tinfo->{'master_opt'},[],0);
} }
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment