Commit 98a4a013 authored by unknown's avatar unknown

Use dynamic switch directly from "server_need_restart" for better control of when to do it.

Remove #!force-restart and #!fresh-datadir


mysql-test/suite/rpl/rpl_1slave_base.cnf:
  Remove #!force-restart and #!fresh-datadir
parent 3fd75555
......@@ -2066,21 +2066,15 @@ sub run_testcase_check_skip_test($)
return 0;
}
sub dynamic_binlog_format_switch {
my ($tinfo)= @_;
# Dynamically switch binlog format started MySQL servers
foreach my $mysqld ( mysqlds() )
{
# Skip servers that are restarted between each test
next if $mysqld->option('#!force-restart');
my ($tinfo, $mysqld)= @_;
my $sql= "include/set_binlog_format_".$tinfo->{binlog_format_switch}.".sql";
my $args;
mtr_init_args(\$args);
mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
mtr_verbose("Dynamically switching binlog format to:",
$tinfo->{binlog_format_switch});
my $res= My::SafeProcess->run
(
name => "switch binlog format ".$mysqld->name(),
......@@ -2093,7 +2087,6 @@ sub dynamic_binlog_format_switch {
{
mtr_error("Failed to switch binlog format");
}
}
}
sub do_before_run_mysqltest($)
......@@ -2287,11 +2280,6 @@ sub run_testcase ($) {
do_before_run_mysqltest($tinfo);
if (defined $tinfo->{binlog_format_switch} )
{
dynamic_binlog_format_switch($tinfo)
}
if ( $opt_check_testcases )
{
run_check_testcase_all($tinfo, "before")
......@@ -2779,11 +2767,6 @@ sub server_need_restart {
return 0;
}
if ( $server->option('#!force-restart') ) {
mtr_verbose("Restart: forced in configuration");
return 1;
}
if ( $tinfo->{'force_restart'} ) {
mtr_verbose("Restart: forced in .opt file");
return 1;
......@@ -2820,6 +2803,10 @@ sub server_need_restart {
}
}
my $is_mysqld= grep ($server eq $_, mysqlds());
if ($is_mysqld)
{
# Check that running process was started with same options
# as the current test requires
my $extra_opt= get_extra_opt($server, $tinfo);
......@@ -2827,6 +2814,8 @@ sub server_need_restart {
if (defined $started_opts and $extra_opt and
! mtr_same_opts($started_opts, $extra_opt) )
{
# TODO Use a list to find all options that can be set dynamically
# Check if diff is binlog format only
# and the next test has $binlog_format_switch set
my @diff_opts= mtr_diff_opts($started_opts, $extra_opt);
......@@ -2837,16 +2826,17 @@ sub server_need_restart {
{
mtr_verbose("Using dynamic switch of binlog format from ",
$diff_opts[0],"to", $diff_opts[1]);
dynamic_binlog_format_switch($tinfo, $server);
}
else
{
mtr_verbose("Restart: running with different options '" .
join(" ", @{$extra_opt}) . "' != '" .
join(" ", @{$server->{'started_opts'}}) . "'" );
return 1;
}
}
}
# Default, no restart
return 0;
......@@ -2985,12 +2975,6 @@ sub start_servers($) {
# Don't delete anything if starting dirty
if (!$opt_start_dirty)
{
# Remove old datadir before starting process
if ($mysqld->option('#!fresh-datadir') and -d $datadir) {
mtr_debug("Removing old datadir: '$datadir'");
rmdir($datadir);
}
my @options= ('log-bin', 'relay-log');
foreach my $option_name ( @options ) {
......
......@@ -16,12 +16,6 @@ log-bin= master-bin
# starting the mysqld
#!use-slave-opt
# Force restart between each test case
#!force-restart
# Always install a fresh datadir before starting process
#!fresh-datadir
log-bin= slave-bin
relay-log= slave-relay-bin
......
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