Commit 7f034f6c authored by unknown's avatar unknown

Prepare for selective restart of slaves

Add comment why test is skipped


mysql-test/lib/mtr_cases.pl:
  Add comments why tets is skipped
  Disable the use of --skip-innodb if test does not need it
mysql-test/lib/mtr_report.pl:
  Print commment why test was skipped
parent 0b752a83
...@@ -243,26 +243,22 @@ sub collect_one_test_case($$$$$$$) { ...@@ -243,26 +243,22 @@ sub collect_one_test_case($$$$$$$) {
if ( $::opt_skip_rpl ) if ( $::opt_skip_rpl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No replication tests(--skip-rpl)";
return; return;
} }
$tinfo->{'slave_num'}= 1; # Default, use one slave $tinfo->{'slave_num'}= 1; # Default, use one slave
# FIXME currently we always restart slaves
$tinfo->{'slave_restart'}= 1;
if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' ) if ( $tname eq 'rpl_failsafe' or $tname eq 'rpl_chain_temp_table' )
{ {
# $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange # $tinfo->{'slave_num'}= 3; # Not 3 ? Check old code, strange
} }
} }
if ( defined mtr_match_prefix($tname,"federated") ) if ( defined mtr_match_prefix($tname,"federated") )
{ {
$tinfo->{'slave_num'}= 1; # Default, use one slave # Default, federated uses the first slave as it's federated database
$tinfo->{'slave_num'}= 1;
# FIXME currently we always restart slaves
$tinfo->{'slave_restart'}= 1;
} }
if ( $::opt_with_ndbcluster_all or defined mtr_match_substring($tname,"ndb") ) if ( $::opt_with_ndbcluster_all or defined mtr_match_substring($tname,"ndb") )
...@@ -273,12 +269,14 @@ sub collect_one_test_case($$$$$$$) { ...@@ -273,12 +269,14 @@ sub collect_one_test_case($$$$$$$) {
{ {
# All ndb test's should be skipped # All ndb test's should be skipped
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster test(--skip-ndbcluster)";
return; return;
} }
if ( ! $::opt_with_ndbcluster ) if ( ! $::opt_with_ndbcluster )
{ {
# Ndb is not supported, skip them # Ndb is not supported, skip them
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No ndbcluster support";
return; return;
} }
} }
...@@ -383,6 +381,7 @@ sub collect_one_test_case($$$$$$$) { ...@@ -383,6 +381,7 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
} }
else else
{ {
...@@ -396,6 +395,7 @@ sub collect_one_test_case($$$$$$$) { ...@@ -396,6 +395,7 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_win32_perl ) if ( $::glob_win32_perl )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No tests with sh scripts on Windows";
} }
else else
{ {
...@@ -433,26 +433,17 @@ sub collect_one_test_case($$$$$$$) { ...@@ -433,26 +433,17 @@ sub collect_one_test_case($$$$$$$) {
if ( $::glob_use_embedded_server ) if ( $::glob_use_embedded_server )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with embedded server";
mtr_report(
"Instance Manager tests are not available in embedded mode. " .
"Test case '$tname' is skipped.");
} }
elsif ( $::opt_ps_protocol ) elsif ( $::opt_ps_protocol )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM with --ps-protocol";
mtr_report(
"Instance Manager tests are not run with --ps-protocol. " .
"Test case '$tname' is skipped.");
} }
elsif ( $::opt_skip_im ) elsif ( $::opt_skip_im )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "No IM support avaliable";
mtr_report(
"Instance Manager executable is unavailable." .
"Test case '$tname' is skipped.");
} }
} }
else else
...@@ -461,8 +452,10 @@ sub collect_one_test_case($$$$$$$) { ...@@ -461,8 +452,10 @@ sub collect_one_test_case($$$$$$$) {
if ( ! $tinfo->{'innodb_test'} ) if ( ! $tinfo->{'innodb_test'} )
{ {
# mtr_report("Adding '--skip-innodb' to $tinfo->{'name'}"); # mtr_verbose("Adding '--skip-innodb' to $tinfo->{'name'}");
push(@{$tinfo->{'master_opt'}}, "--skip-innodb"); # FIXME activate the --skip-innodb only when running with
# selected test cases
# push(@{$tinfo->{'master_opt'}}, "--skip-innodb");
} }
} }
...@@ -472,6 +465,7 @@ sub collect_one_test_case($$$$$$$) { ...@@ -472,6 +465,7 @@ sub collect_one_test_case($$$$$$$) {
( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) ) ( $tinfo->{'master_restart'} or $tinfo->{'slave_restart'} ) )
{ {
$tinfo->{'skip'}= 1; $tinfo->{'skip'}= 1;
$tinfo->{'comment'}= "Can't restart a running server";
} }
} }
......
...@@ -97,7 +97,7 @@ sub mtr_report_test_skipped ($) { ...@@ -97,7 +97,7 @@ sub mtr_report_test_skipped ($) {
} }
else else
{ {
print "[ skipped ]\n"; print "[ skipped ] $tinfo->{'comment'}\n";
} }
} }
......
...@@ -900,7 +900,7 @@ sub command_line_setup () { ...@@ -900,7 +900,7 @@ sub command_line_setup () {
port => $opt_master_myport, port => $opt_master_myport,
start_timeout => 400, # enough time create innodb tables start_timeout => 400, # enough time create innodb tables
cluster => 0, # index in clusters list cluster => 0, # index in clusters list
master_opt => [], start_opts => [],
}; };
$master->[1]= $master->[1]=
...@@ -915,6 +915,7 @@ sub command_line_setup () { ...@@ -915,6 +915,7 @@ sub command_line_setup () {
port => $opt_master_myport + 1, port => $opt_master_myport + 1,
start_timeout => 400, # enough time create innodb tables start_timeout => 400, # enough time create innodb tables
cluster => 0, # index in clusters list cluster => 0, # index in clusters list
start_opts => [],
}; };
$slave->[0]= $slave->[0]=
...@@ -930,6 +931,7 @@ sub command_line_setup () { ...@@ -930,6 +931,7 @@ sub command_line_setup () {
start_timeout => 400, start_timeout => 400,
cluster => 1, # index in clusters list cluster => 1, # index in clusters list
start_opts => [],
}; };
$slave->[1]= $slave->[1]=
...@@ -944,6 +946,7 @@ sub command_line_setup () { ...@@ -944,6 +946,7 @@ sub command_line_setup () {
port => $opt_slave_myport + 1, port => $opt_slave_myport + 1,
start_timeout => 300, start_timeout => 300,
cluster => -1, # index in clusters list cluster => -1, # index in clusters list
start_opts => [],
}; };
$slave->[2]= $slave->[2]=
...@@ -958,6 +961,7 @@ sub command_line_setup () { ...@@ -958,6 +961,7 @@ sub command_line_setup () {
port => $opt_slave_myport + 2, port => $opt_slave_myport + 2,
start_timeout => 300, start_timeout => 300,
cluster => -1, # index in clusters list cluster => -1, # index in clusters list
start_opts => [],
}; };
$instance_manager= $instance_manager=
...@@ -2262,6 +2266,8 @@ sub run_testcase ($) { ...@@ -2262,6 +2266,8 @@ sub run_testcase ($) {
elsif ( $res == 62 ) elsif ( $res == 62 )
{ {
# Testcase itself tell us to skip this one # Testcase itself tell us to skip this one
# FIXME get reason to skip from mysqltest
$tinfo->{'comment'}= "Detected by testcase";
mtr_report_test_skipped($tinfo); mtr_report_test_skipped($tinfo);
} }
elsif ( $res == 63 ) elsif ( $res == 63 )
...@@ -2361,7 +2367,6 @@ sub restore_installed_db ($) { ...@@ -2361,7 +2367,6 @@ sub restore_installed_db ($) {
{ {
foreach my $ndbd (@{$cluster->{'ndbds'}}) foreach my $ndbd (@{$cluster->{'ndbds'}})
{ {
mtr_verbose("$ndbd->{'path_fs'}" );
rmtree("$ndbd->{'path_fs'}" ); rmtree("$ndbd->{'path_fs'}" );
} }
} }
...@@ -2373,7 +2378,6 @@ sub restore_installed_db ($) { ...@@ -2373,7 +2378,6 @@ sub restore_installed_db ($) {
} }
} }
sub report_failure_and_restart ($) { sub report_failure_and_restart ($) {
my $tinfo= shift; my $tinfo= shift;
...@@ -2831,6 +2835,10 @@ sub mysqld_start ($$$) { ...@@ -2831,6 +2835,10 @@ sub mysqld_start ($$$) {
# Remember pid of the started process # Remember pid of the started process
$mysqld->{'pid'}= $pid; $mysqld->{'pid'}= $pid;
# Remember options used when starting
$mysqld->{'start_opts'}= $extra_opt;
mtr_verbose("mysqld pid: $pid"); mtr_verbose("mysqld pid: $pid");
return $pid; return $pid;
} }
...@@ -2930,27 +2938,27 @@ sub run_testcase_stop_servers($) { ...@@ -2930,27 +2938,27 @@ sub run_testcase_stop_servers($) {
return; return;
} }
# We try to find out if we are to restart the server # We try to find out if we are to restart the master(s)
my $do_restart= 0; # Assumes we don't have to my $do_restart= 0; # Assumes we don't have to
if ( $tinfo->{'master_sh'} ) if ( $tinfo->{'master_sh'} )
{ {
$do_restart= 1; # Always restart if script to run $do_restart= 1; # Always restart if script to run
mtr_report("Restart because: Always restart if script to run"); mtr_verbose("Restart because: Always restart if script to run");
} }
elsif ( $opt_with_ndbcluster and elsif ( $opt_with_ndbcluster and
$tinfo->{'ndb_test'} == 0 and $tinfo->{'ndb_test'} == 0 and
$clusters->[0]->{'pid'} != 0 ) $clusters->[0]->{'pid'} != 0 )
{ {
$do_restart= 1; # Restart without cluster $do_restart= 1; # Restart without cluster
mtr_report("Restart because: Test does not need cluster"); mtr_verbose("Restart because: Test does not need cluster");
} }
elsif ( $opt_with_ndbcluster and elsif ( $opt_with_ndbcluster and
$tinfo->{'ndb_test'} == 1 and $tinfo->{'ndb_test'} == 1 and
$clusters->[0]->{'pid'} == 0 ) $clusters->[0]->{'pid'} == 0 )
{ {
$do_restart= 1; # Restart with cluster $do_restart= 1; # Restart with cluster
mtr_report("Restart because: Test need cluster"); mtr_verbose("Restart because: Test need cluster");
} }
elsif ( $master->[0]->{'running_master_is_special'} and elsif ( $master->[0]->{'running_master_is_special'} and
$master->[0]->{'running_master_is_special'}->{'timezone'} eq $master->[0]->{'running_master_is_special'}->{'timezone'} eq
...@@ -2959,24 +2967,30 @@ sub run_testcase_stop_servers($) { ...@@ -2959,24 +2967,30 @@ sub run_testcase_stop_servers($) {
$tinfo->{'master_opt'}) ) $tinfo->{'master_opt'}) )
{ {
# If running master was started with special settings, but # If running master was started with special settings, but
# the current test requuires the same ones, we *don't* restart. # the current test requires the same ones, we *don't* restart.
$do_restart= 0; $do_restart= 0;
mtr_report("Skip restart: options are equal " . mtr_verbose("Skip restart: options are equal " .
join(" ", @{$tinfo->{'master_opt'}})); join(" ", @{$tinfo->{'master_opt'}}));
} }
elsif ( $tinfo->{'master_restart'} or elsif ( $tinfo->{'master_restart'} )
$master->[0]->{'running_master_is_special'} ) {
$do_restart= 1;
mtr_verbose("Restart because: master_restart");
}
elsif ( $master->[0]->{'running_master_is_special'} )
{ {
$do_restart= 1; $do_restart= 1;
mtr_report("Restart because: master_restart or running_master_is_special"); mtr_verbose("Restart because: running_master_is_special");
} }
# Check that running master was started with same options # Check that running master was started with same options
# as the current test requires # as the current test requires
elsif (! mtr_same_opts($master->[0]->{'master_opt'}, elsif (! mtr_same_opts($master->[0]->{'start_opts'},
$tinfo->{'master_opt'}) ) $tinfo->{'master_opt'}) )
{ {
$do_restart= 1; $do_restart= 1;
mtr_report("Restart because: running with different options"); mtr_verbose("Restart because: running with different options '" .
join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
} }
my $pid; my $pid;
...@@ -3036,56 +3050,110 @@ sub run_testcase_stop_servers($) { ...@@ -3036,56 +3050,110 @@ sub run_testcase_stop_servers($) {
} }
} }
# We try to find out if we are to restart the slaves
# ---------------------------------------------------------------------- my $do_slave_restart= 0; # Assumes we don't have to
# Always terminate all slaves, if any. Else we may have useless
# reconnection attempts and error messages in case the slave and # FIXME only restaret when necessary
# master servers restart. $do_slave_restart= 1;
# ----------------------------------------------------------------------
# if ( ! $slave->[0]->{'pid'} )
# Start shutdown of all started slaves # {
foreach my $mysqld (@{$slave}) # # mtr_verbose("Slave not started, no need to check slave restart");
{ # }
if ( $mysqld->{'pid'} ) # elsif ( $do_restart )
# {
# $do_slave_restart= 1; # Always restart if master restart
# mtr_verbose("Restart slave because: Master restart");
# }
# elsif ( $tinfo->{'slave_sh'} )
# {
# $do_slave_restart= 1; # Always restart if script to run
# mtr_verbose("Restart slave because: Always restart if script to run");
# }
# elsif ( $opt_with_ndbcluster and
# $tinfo->{'ndb_test'} == 0 and
# $clusters->[1]->{'pid'} != 0 )
# {
# $do_slave_restart= 1; # Restart without slave cluster
# mtr_verbose("Restart slave because: Test does not need slave cluster");
# }
# elsif ( $opt_with_ndbcluster and
# $tinfo->{'ndb_test'} == 1 and
# $clusters->[1]->{'pid'} == 0 )
# {
# $do_slave_restart= 1; # Restart with slave cluster
# mtr_verbose("Restart slave because: Test need slave cluster");
# }
# elsif ( $tinfo->{'slave_restart'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: slave_restart");
# }
# elsif ( $slave->[0]->{'running_slave_is_special'} )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running_slave_is_special");
# }
# # Check that running slave was started with same options
# # as the current test requires
# elsif (! mtr_same_opts($slave->[0]->{'start_opts'},
# $tinfo->{'slave_opt'}) )
# {
# $do_slave_restart= 1;
# mtr_verbose("Restart slave because: running with different options '" .
# join(" ", @{$tinfo->{'slave_opt'}}) . "' != '" .
# join(" ", @{$slave->[0]->{'start_opts'}}) . "'" );
# }
if ( $do_slave_restart )
{
delete $slave->[0]->{'running_slave_is_special'}; # Forget history
# Start shutdown of all started slaves
foreach my $mysqld (@{$slave})
{ {
$pid= mtr_mysqladmin_start($mysqld, "shutdown", 70); if ( $mysqld->{'pid'} )
{
$pid= mtr_mysqladmin_start($mysqld, "shutdown", 70);
$admin_pids{$pid}= 1; $admin_pids{$pid}= 1;
push(@kill_pids,{ push(@kill_pids,{
pid => $mysqld->{'pid'}, pid => $mysqld->{'pid'},
pidfile => $mysqld->{'path_pid'}, pidfile => $mysqld->{'path_pid'},
sockfile => $mysqld->{'path_sock'}, sockfile => $mysqld->{'path_sock'},
port => $mysqld->{'port'}, port => $mysqld->{'port'},
}); });
$mysqld->{'pid'}= 0; # Assume we are done with it $mysqld->{'pid'}= 0; # Assume we are done with it
}
} }
}
# Start shutdown of slave cluster
my $cluster= $clusters->[1];
if ( $cluster->{'pid'} )
{
$pid= mtr_ndbmgm_start($cluster, "shutdown");
$admin_pids{$pid}= 1; # Start shutdown of slave cluster
my $cluster= $clusters->[1];
push(@kill_pids,{ if ( $cluster->{'pid'} )
pid => $cluster->{'pid'}, {
pidfile => $cluster->{'path_pid'} $pid= mtr_ndbmgm_start($cluster, "shutdown");
});
$cluster->{'pid'}= 0; # Assume we are done with it $admin_pids{$pid}= 1;
foreach my $ndbd (@{$cluster->{'ndbds'}} )
{
push(@kill_pids,{ push(@kill_pids,{
pid => $ndbd->{'pid'}, pid => $cluster->{'pid'},
pidfile => $ndbd->{'path_pid'}, pidfile => $cluster->{'path_pid'}
}); });
$ndbd->{'pid'}= 0; # Assume we are done with it
$cluster->{'pid'}= 0; # Assume we are done with it
foreach my $ndbd (@{$cluster->{'ndbds'}} )
{
push(@kill_pids,{
pid => $ndbd->{'pid'},
pidfile => $ndbd->{'path_pid'},
});
$ndbd->{'pid'}= 0; # Assume we are done with it
}
} }
} }
...@@ -3138,13 +3206,12 @@ sub run_testcase_start_servers($) { ...@@ -3138,13 +3206,12 @@ sub run_testcase_start_servers($) {
mysqld_start($master->[0],$tinfo->{'master_opt'},[]); mysqld_start($master->[0],$tinfo->{'master_opt'},[]);
# Remember options used to start
$master->[0]->{'master_opt'}= $tinfo->{'master_opt'};
} }
if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} ) if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} )
{ {
# Test needs cluster, start an extra mysqld connected to cluster # Test needs cluster, start an extra mysqld connected to cluster
# First wait for first mysql server to have created ndb system tables ok # First wait for first mysql server to have created ndb system tables ok
# FIXME This is a workaround so that only one mysqld creates the tables # FIXME This is a workaround so that only one mysqld creates the tables
if ( ! sleep_until_file_created( if ( ! sleep_until_file_created(
...@@ -3202,8 +3269,16 @@ sub run_testcase_start_servers($) { ...@@ -3202,8 +3269,16 @@ sub run_testcase_start_servers($) {
{ {
mysqld_start($slave->[$idx],$tinfo->{'slave_opt'}, mysqld_start($slave->[$idx],$tinfo->{'slave_opt'},
$tinfo->{'slave_mi'}); $tinfo->{'slave_mi'});
} }
} }
if ( $tinfo->{'slave_restart'} )
{
# Save this test case information, so next can examine it
$slave->[0]->{'running_slave_is_special'}= $tinfo;
}
} }
# Wait for clusters to start # Wait for clusters to start
......
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