mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Improve 'run_testcase_need_master_restart' to require restart if master is not already started
Improve 'run_testcase_need_slave_restart' to detect if a slave restart really is necessary. So far all rpl test requires a slave restart, but for all other tests it can be skipped Improve the sort order used by --reorder
This commit is contained in:
parent
f638be87cb
commit
22f1cc58c2
2 changed files with 51 additions and 63 deletions
|
@ -164,31 +164,36 @@ sub collect_test_cases ($) {
|
|||
# Make a mapping of test name to a string that represents how that test
|
||||
# should be sorted among the other tests. Put the most important criterion
|
||||
# first, then a sub-criterion, then sub-sub-criterion, et c.
|
||||
foreach $tinfo (@$cases)
|
||||
foreach $tinfo (@$cases)
|
||||
{
|
||||
my @this_criteria = ();
|
||||
|
||||
#
|
||||
# Append the criteria for sorting, in order of importance.
|
||||
push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~"); # Ending with "~" makes empty sort later than filled
|
||||
#
|
||||
|
||||
push(@this_criteria, "ndb=" . ($tinfo->{'ndb_test'} ? "1" : "0"));
|
||||
push(@this_criteria, "restart=" . ($tinfo->{'master_restart'} ? "1" : "0"));
|
||||
push(@this_criteria, "big_test=" . ($tinfo->{'big_test'} ? "1" : "0"));
|
||||
push(@this_criteria, join("|", sort keys %{$tinfo})); # Group similar things together. The values may differ substantially. FIXME?
|
||||
push(@this_criteria, $tinfo->{'name'}); # Finally, order by the name
|
||||
|
||||
# Group test with similar options together.
|
||||
# Ending with "~" makes empty sort later than filled
|
||||
push(@this_criteria, join("!", sort @{$tinfo->{'master_opt'}}) . "~");
|
||||
|
||||
# Finally, order by the name
|
||||
push(@this_criteria, $tinfo->{'name'});
|
||||
|
||||
$sort_criteria{$tinfo->{"name"}} = join(" ", @this_criteria);
|
||||
}
|
||||
|
||||
@$cases = sort { $sort_criteria{$a->{"name"}} cmp $sort_criteria{$b->{"name"}}; } @$cases;
|
||||
|
||||
### For debugging the sort-order
|
||||
# foreach $tinfo (@$cases)
|
||||
# {
|
||||
# print $sort_criteria{$tinfo->{"name"}};
|
||||
# print " -> \t";
|
||||
# print $tinfo->{"name"};
|
||||
# print "\n";
|
||||
# }
|
||||
foreach $tinfo (@$cases)
|
||||
{
|
||||
print $sort_criteria{$tinfo->{"name"}};
|
||||
print " -> \t";
|
||||
print $tinfo->{"name"};
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $cases;
|
||||
|
|
|
@ -3522,6 +3522,11 @@ sub run_testcase_need_master_restart($)
|
|||
join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
|
||||
join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
|
||||
}
|
||||
elsif( ! $master->[0]->{'pid'} )
|
||||
{
|
||||
$do_restart= 1;
|
||||
mtr_verbose("Restart because: master is not started");
|
||||
}
|
||||
|
||||
return $do_restart;
|
||||
}
|
||||
|
@ -3533,57 +3538,35 @@ sub run_testcase_need_slave_restart($)
|
|||
# We try to find out if we are to restart the slaves
|
||||
my $do_slave_restart= 0; # Assumes we don't have to
|
||||
|
||||
# FIXME only restart slave when necessary
|
||||
$do_slave_restart= 1;
|
||||
if ( $max_slave_num == 0)
|
||||
{
|
||||
mtr_verbose("No testcase use slaves, no slave restarts");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
# if ( ! $slave->[0]->{'pid'} )
|
||||
# {
|
||||
# # mtr_verbose("Slave not started, no need to check slave restart");
|
||||
# }
|
||||
# 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_skip_ndbcluster_slave 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_slave 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'}}) . "'" );
|
||||
# }
|
||||
# Check if any slave is currently started
|
||||
my $any_slave_started= 0;
|
||||
foreach my $mysqld (@{$slave})
|
||||
{
|
||||
if ( $mysqld->{'pid'} )
|
||||
{
|
||||
$any_slave_started= 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
if ($any_slave_started)
|
||||
{
|
||||
mtr_verbose("Any slave is started, need to restart");
|
||||
$do_slave_restart= 1;
|
||||
}
|
||||
elsif ( $tinfo->{'slave_num'} )
|
||||
{
|
||||
mtr_verbose("Test need slave, check for restart");
|
||||
$do_slave_restart= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $do_slave_restart;
|
||||
|
||||
|
|
Loading…
Reference in a new issue