Commit ace654d6 authored by unknown's avatar unknown

Count number of masters the test is actually using and only start as

many as neeeded

parent 6914a6b3
...@@ -288,6 +288,7 @@ sub collect_one_test_case($$$$$$$) { ...@@ -288,6 +288,7 @@ sub collect_one_test_case($$$$$$$) {
$tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work $tinfo->{'timezone'}= "GMT-3"; # for UNIX_TIMESTAMP tests to work
$tinfo->{'slave_num'}= 0; # Default, no slave $tinfo->{'slave_num'}= 0; # Default, no slave
$tinfo->{'master_num'}= 1; # Default, 1 master
if ( defined mtr_match_prefix($tname,"rpl") ) if ( defined mtr_match_prefix($tname,"rpl") )
{ {
if ( $::opt_skip_rpl ) if ( $::opt_skip_rpl )
...@@ -297,13 +298,8 @@ sub collect_one_test_case($$$$$$$) { ...@@ -297,13 +298,8 @@ sub collect_one_test_case($$$$$$$) {
return; return;
} }
$tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave $tinfo->{'slave_num'}= 1; # Default for rpl* tests, use one slave
if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
{
# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
}
} }
if ( defined mtr_match_prefix($tname,"federated") ) if ( defined mtr_match_prefix($tname,"federated") )
...@@ -582,6 +578,7 @@ our @tags= ...@@ -582,6 +578,7 @@ our @tags=
["include/have_debug.inc", "need_debug", 1], ["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1], ["include/have_ndb.inc", "ndb_test", 1],
["include/have_ndb_extra.inc", "ndb_extra", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1],
["include/have_multi_ndb.inc", "master_num", 2],
["require_manager", "require_manager", 1], ["require_manager", "require_manager", 1],
); );
......
...@@ -227,6 +227,7 @@ our $opt_mark_progress; ...@@ -227,6 +227,7 @@ our $opt_mark_progress;
our $opt_skip; our $opt_skip;
our $opt_skip_rpl; our $opt_skip_rpl;
our $max_slave_num= 0; our $max_slave_num= 0;
our $max_master_num= 0;
our $use_innodb; our $use_innodb;
our $opt_skip_test; our $opt_skip_test;
our $opt_skip_im; our $opt_skip_im;
...@@ -404,6 +405,15 @@ sub main () { ...@@ -404,6 +405,15 @@ sub main () {
$max_slave_num= $test->{slave_num}; $max_slave_num= $test->{slave_num};
mtr_error("Too many slaves") if $max_slave_num > 3; mtr_error("Too many slaves") if $max_slave_num > 3;
} }
# Count max number of masters used by a test case
if ( $test->{master_num} > $max_master_num)
{
$max_master_num= $test->{master_num};
mtr_error("Too many masters") if $max_master_num > 2;
mtr_error("Too few masters") if $max_master_num < 1;
}
$use_innodb||= $test->{'innodb_test'}; $use_innodb||= $test->{'innodb_test'};
} }
...@@ -1235,9 +1245,10 @@ sub command_line_setup () { ...@@ -1235,9 +1245,10 @@ sub command_line_setup () {
sub datadir_list_setup () { sub datadir_list_setup () {
# Make a list of all data_dirs # Make a list of all data_dirs
@data_dir_lst = ( for (my $idx= 0; $idx < $max_master_num; $idx++)
$master->[0]->{'path_myddir'}, {
$master->[1]->{'path_myddir'}); push(@data_dir_lst, $master->[$idx]->{'path_myddir'});
}
for (my $idx= 0; $idx < $max_slave_num; $idx++) for (my $idx= 0; $idx < $max_slave_num; $idx++)
{ {
...@@ -2644,8 +2655,10 @@ sub mysql_install_db () { ...@@ -2644,8 +2655,10 @@ sub mysql_install_db () {
install_db('master', $master->[0]->{'path_myddir'}); install_db('master', $master->[0]->{'path_myddir'});
# FIXME check if testcase really is using second master if ($max_master_num)
copy_install_db('master', $master->[1]->{'path_myddir'}); {
copy_install_db('master', $master->[1]->{'path_myddir'});
}
# Install the number of slave databses needed # Install the number of slave databses needed
for (my $idx= 0; $idx < $max_slave_num; $idx++) for (my $idx= 0; $idx < $max_slave_num; $idx++)
...@@ -4179,7 +4192,8 @@ sub run_testcase_start_servers($) { ...@@ -4179,7 +4192,8 @@ sub run_testcase_start_servers($) {
} }
if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} ) if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and
$tinfo->{'master_num'} > 1 )
{ {
# Test needs cluster, start an extra mysqld connected to cluster # Test needs cluster, start an extra mysqld connected to cluster
......
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