Bug #24168 mysql-test-run not functioning in autotest (cannot use external cluster)
- Removed the global variable(s) glob_use_running_cluster/slave and put a property on each "cluster" called "use_running" which is set to 1 if user passed either ndb_connectstring or ndb_connectstring_slave. Thus mtr.pl should not start/stop the cluster. mysql-test/lib/mtr_process.pl: Removed the global variable(s) glob_use_running_cluster/slave and put a property on each "cluster" called "use_running" which is set to 1 if user passed either ndb_connectstring or ndb_connectstring_slave. Thus mtr.pl should not start/stop the cluster mysql-test/mysql-test-run.pl: Removed the global variable(s) glob_use_running_cluster/slave and put a property on each "cluster" called "use_running" which is set to 1 if user passed either ndb_connectstring or ndb_connectstring_slave. Thus mtr.pl should not start/stop the cluster
This commit is contained in:
parent
288a7fc0c9
commit
38f0d480f9
@ -385,11 +385,13 @@ sub mtr_kill_leftovers () {
|
|||||||
|
|
||||||
if ( ! $::opt_skip_ndbcluster )
|
if ( ! $::opt_skip_ndbcluster )
|
||||||
{
|
{
|
||||||
# Start shutdown of clusters.
|
|
||||||
mtr_debug("Shutting down cluster...");
|
|
||||||
|
|
||||||
foreach my $cluster (@{$::clusters})
|
foreach my $cluster (@{$::clusters})
|
||||||
{
|
{
|
||||||
|
|
||||||
|
# Don't shut down a "running" cluster
|
||||||
|
next if $cluster->{'use_running'};
|
||||||
|
|
||||||
mtr_debug(" - cluster " .
|
mtr_debug(" - cluster " .
|
||||||
"(pid: $cluster->{pid}; " .
|
"(pid: $cluster->{pid}; " .
|
||||||
"pid file: '$cluster->{path_pid})");
|
"pid file: '$cluster->{path_pid})");
|
||||||
|
@ -104,8 +104,6 @@ our $glob_mysql_bench_dir= undef;
|
|||||||
our $glob_hostname= undef;
|
our $glob_hostname= undef;
|
||||||
our $glob_scriptname= undef;
|
our $glob_scriptname= undef;
|
||||||
our $glob_timers= undef;
|
our $glob_timers= undef;
|
||||||
our $glob_use_running_ndbcluster= 0;
|
|
||||||
our $glob_use_running_ndbcluster_slave= 0;
|
|
||||||
our $glob_use_embedded_server= 0;
|
our $glob_use_embedded_server= 0;
|
||||||
our @glob_test_mode;
|
our @glob_test_mode;
|
||||||
|
|
||||||
@ -929,40 +927,6 @@ sub command_line_setup () {
|
|||||||
push(@glob_test_mode, "ps-protocol");
|
push(@glob_test_mode, "ps-protocol");
|
||||||
}
|
}
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
# Ndb cluster flags
|
|
||||||
# --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if ( $opt_ndbconnectstring )
|
|
||||||
{
|
|
||||||
$glob_use_running_ndbcluster= 1;
|
|
||||||
mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
|
|
||||||
if $opt_skip_ndbcluster;
|
|
||||||
mtr_error("Can't specify --ndb-connectstring and --ndbcluster-port")
|
|
||||||
if $opt_ndbcluster_port;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Set default connect string
|
|
||||||
$opt_ndbconnectstring= "host=localhost:$opt_ndbcluster_port";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $opt_ndbconnectstring_slave )
|
|
||||||
{
|
|
||||||
$glob_use_running_ndbcluster_slave= 1;
|
|
||||||
mtr_error("Can't specify ndb-connectstring_slave and " .
|
|
||||||
"--skip-ndbcluster-slave")
|
|
||||||
if $opt_skip_ndbcluster;
|
|
||||||
mtr_error("Can't specify --ndb-connectstring-slave and " .
|
|
||||||
"--ndbcluster-port-slave")
|
|
||||||
if $opt_ndbcluster_port_slave;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
# Set default connect string
|
|
||||||
$opt_ndbconnectstring_slave= "host=localhost:$opt_ndbcluster_port_slave";
|
|
||||||
}
|
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Bench flags
|
# Bench flags
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@ -1206,7 +1170,7 @@ sub command_line_setup () {
|
|||||||
nodes => 2,
|
nodes => 2,
|
||||||
port => "$opt_ndbcluster_port",
|
port => "$opt_ndbcluster_port",
|
||||||
data_dir => "$data_dir",
|
data_dir => "$data_dir",
|
||||||
connect_string => "$opt_ndbconnectstring",
|
connect_string => "host=localhost:$opt_ndbcluster_port",
|
||||||
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
|
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
|
||||||
pid => 0, # pid of ndb_mgmd
|
pid => 0, # pid of ndb_mgmd
|
||||||
installed_ok => 0,
|
installed_ok => 0,
|
||||||
@ -1219,7 +1183,7 @@ sub command_line_setup () {
|
|||||||
nodes => 1,
|
nodes => 1,
|
||||||
port => "$opt_ndbcluster_port_slave",
|
port => "$opt_ndbcluster_port_slave",
|
||||||
data_dir => "$data_dir",
|
data_dir => "$data_dir",
|
||||||
connect_string => "$opt_ndbconnectstring_slave",
|
connect_string => "host=localhost:$opt_ndbcluster_port_slave",
|
||||||
path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
|
path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
|
||||||
pid => 0, # pid of ndb_mgmd
|
pid => 0, # pid of ndb_mgmd
|
||||||
installed_ok => 0,
|
installed_ok => 0,
|
||||||
@ -1241,6 +1205,9 @@ sub command_line_setup () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# extern
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
if ( $opt_extern )
|
if ( $opt_extern )
|
||||||
{
|
{
|
||||||
# Turn off features not supported when running with extern server
|
# Turn off features not supported when running with extern server
|
||||||
@ -1257,6 +1224,38 @@ sub command_line_setup () {
|
|||||||
if $opt_socket;
|
if $opt_socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
# ndbconnectstring and ndbconnectstring_slave
|
||||||
|
# --------------------------------------------------------------------------
|
||||||
|
if ( $opt_ndbconnectstring )
|
||||||
|
{
|
||||||
|
# ndbconnectstring was supplied by user, the tests shoudl be run
|
||||||
|
# against an already started cluster, change settings
|
||||||
|
my $cluster= $clusters->[0]; # Master cluster
|
||||||
|
$cluster->{'connect_string'}= $opt_ndbconnectstring;
|
||||||
|
$cluster->{'use_running'}= 1;
|
||||||
|
|
||||||
|
mtr_error("Can't specify --ndb-connectstring and --skip-ndbcluster")
|
||||||
|
if $opt_skip_ndbcluster;
|
||||||
|
}
|
||||||
|
$ENV{'NDB_CONNECTSTRING'}= $clusters->[0]->{'connect_string'};
|
||||||
|
|
||||||
|
|
||||||
|
if ( $opt_ndbconnectstring_slave )
|
||||||
|
{
|
||||||
|
# ndbconnectstring-slave was supplied by user, the tests should be run
|
||||||
|
# agains an already started slave cluster, change settings
|
||||||
|
my $cluster= $clusters->[1]; # Slave cluster
|
||||||
|
$cluster->{'connect_string'}= $opt_ndbconnectstring_slave;
|
||||||
|
$cluster->{'use_running'}= 1;
|
||||||
|
|
||||||
|
mtr_error("Can't specify ndb-connectstring_slave and " .
|
||||||
|
"--skip-ndbcluster-slave")
|
||||||
|
if $opt_skip_ndbcluster_slave;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$path_timefile= "$opt_vardir/log/mysqltest-time";
|
$path_timefile= "$opt_vardir/log/mysqltest-time";
|
||||||
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
|
$path_mysqltest_log= "$opt_vardir/log/mysqltest.log";
|
||||||
$path_current_test_log= "$opt_vardir/log/current_test";
|
$path_current_test_log= "$opt_vardir/log/current_test";
|
||||||
@ -1860,7 +1859,6 @@ sub environment_setup () {
|
|||||||
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
|
$ENV{'NDB_DATA_DIR'}= $clusters->[0]->{'data_dir'};
|
||||||
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
|
$ENV{'NDB_TOOLS_DIR'}= $path_ndb_tools_dir;
|
||||||
$ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
|
$ENV{'NDB_TOOLS_OUTPUT'}= $path_ndb_testrun_log;
|
||||||
$ENV{'NDB_CONNECTSTRING'}= $opt_ndbconnectstring;
|
|
||||||
|
|
||||||
if ( $mysql_version_id >= 50000 )
|
if ( $mysql_version_id >= 50000 )
|
||||||
{
|
{
|
||||||
@ -2688,7 +2686,7 @@ sub ndbcluster_start ($$) {
|
|||||||
|
|
||||||
mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
|
mtr_verbose("ndbcluster_start '$cluster->{'name'}'");
|
||||||
|
|
||||||
if ( $glob_use_running_ndbcluster )
|
if ( $cluster->{'use_running'} )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2905,30 +2903,34 @@ sub mysql_install_db () {
|
|||||||
|
|
||||||
my $cluster_started_ok= 1; # Assume it can be started
|
my $cluster_started_ok= 1; # Assume it can be started
|
||||||
|
|
||||||
if ($opt_skip_ndbcluster || $glob_use_running_ndbcluster ||
|
my $cluster= $clusters->[0]; # Master cluster
|
||||||
$clusters->[0]->{executable_setup_failed})
|
if ($opt_skip_ndbcluster ||
|
||||||
|
$cluster->{'use_running'} ||
|
||||||
|
$cluster->{executable_setup_failed})
|
||||||
{
|
{
|
||||||
# Don't install master cluster
|
# Don't install master cluster
|
||||||
}
|
}
|
||||||
elsif (ndbcluster_start_install($clusters->[0]))
|
elsif (ndbcluster_start_install($cluster))
|
||||||
{
|
{
|
||||||
mtr_warning("Failed to start install of $clusters->[0]->{name}");
|
mtr_warning("Failed to start install of $cluster->{name}");
|
||||||
$cluster_started_ok= 0;
|
$cluster_started_ok= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cluster= $clusters->[1]; # Slave cluster
|
||||||
if ($max_slave_num == 0 ||
|
if ($max_slave_num == 0 ||
|
||||||
$opt_skip_ndbcluster_slave || $glob_use_running_ndbcluster_slave ||
|
$opt_skip_ndbcluster_slave ||
|
||||||
$clusters->[1]->{executable_setup_failed})
|
$cluster->{'use_running'} ||
|
||||||
|
$cluster->{executable_setup_failed})
|
||||||
{
|
{
|
||||||
# Don't install slave cluster
|
# Don't install slave cluster
|
||||||
}
|
}
|
||||||
elsif (ndbcluster_start_install($clusters->[1]))
|
elsif (ndbcluster_start_install($cluster))
|
||||||
{
|
{
|
||||||
mtr_warning("Failed to start install of $clusters->[1]->{name}");
|
mtr_warning("Failed to start install of $cluster->{name}");
|
||||||
$cluster_started_ok= 0;
|
$cluster_started_ok= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach my $cluster (@{$clusters})
|
foreach $cluster (@{$clusters})
|
||||||
{
|
{
|
||||||
|
|
||||||
next if !$cluster->{'pid'};
|
next if !$cluster->{'pid'};
|
||||||
@ -3203,9 +3205,16 @@ sub run_testcase_check_skip_test($)
|
|||||||
{
|
{
|
||||||
foreach my $cluster (@{$clusters})
|
foreach my $cluster (@{$clusters})
|
||||||
{
|
{
|
||||||
|
# Slave cluster is skipped and thus not
|
||||||
|
# installed, no need to perform checks
|
||||||
last if ($opt_skip_ndbcluster_slave and
|
last if ($opt_skip_ndbcluster_slave and
|
||||||
$cluster->{'name'} eq 'Slave');
|
$cluster->{'name'} eq 'Slave');
|
||||||
|
|
||||||
|
# Using running cluster - no need
|
||||||
|
# to check if test should be skipped
|
||||||
|
# will be done by test itself
|
||||||
|
last if ($cluster->{'use_running'});
|
||||||
|
|
||||||
# If test needs this cluster, check binaries was found ok
|
# If test needs this cluster, check binaries was found ok
|
||||||
if ( $cluster->{'executable_setup_failed'} )
|
if ( $cluster->{'executable_setup_failed'} )
|
||||||
{
|
{
|
||||||
@ -3819,12 +3828,8 @@ sub mysqld_arguments ($$$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $cluster= $clusters->[$mysqld->{'cluster'}];
|
my $cluster= $clusters->[$mysqld->{'cluster'}];
|
||||||
if ( $opt_skip_ndbcluster ||
|
if ( $cluster->{'pid'} || # Cluster is started
|
||||||
!$cluster->{'pid'})
|
$cluster->{'use_running'} ) # Using running cluster
|
||||||
{
|
|
||||||
mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "%s--ndbcluster", $prefix);
|
mtr_add_arg($args, "%s--ndbcluster", $prefix);
|
||||||
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
|
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
|
||||||
@ -3834,6 +3839,10 @@ sub mysqld_arguments ($$$$) {
|
|||||||
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
|
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
|
||||||
|
}
|
||||||
|
|
||||||
mtr_add_arg($args, "%s--plugin_dir=%s", $prefix,
|
mtr_add_arg($args, "%s--plugin_dir=%s", $prefix,
|
||||||
dirname($lib_example_plugin));
|
dirname($lib_example_plugin));
|
||||||
@ -3892,23 +3901,24 @@ sub mysqld_arguments ($$$$) {
|
|||||||
mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
|
mtr_add_arg($args, "%s--rpl-recovery-rank=%d", $prefix, $slave_rpl_rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $opt_skip_ndbcluster_slave ||
|
my $cluster= $clusters->[$mysqld->{'cluster'}];
|
||||||
$mysqld->{'cluster'} == -1 ||
|
if ( $cluster->{'pid'} || # Slave cluster is started
|
||||||
!$clusters->[$mysqld->{'cluster'}]->{'pid'} )
|
$cluster->{'use_running'} ) # Using running slave cluster
|
||||||
{
|
|
||||||
mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "%s--ndbcluster", $prefix);
|
mtr_add_arg($args, "%s--ndbcluster", $prefix);
|
||||||
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
|
mtr_add_arg($args, "%s--ndb-connectstring=%s", $prefix,
|
||||||
$clusters->[$mysqld->{'cluster'}]->{'connect_string'});
|
$cluster->{'connect_string'});
|
||||||
|
|
||||||
if ( $mysql_version_id >= 50100 )
|
if ( $mysql_version_id >= 50100 )
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
|
mtr_add_arg($args, "%s--ndb-extra-logging", $prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mtr_add_arg($args, "%s--loose-skip-ndbcluster", $prefix);
|
||||||
|
}
|
||||||
|
|
||||||
} # end slave
|
} # end slave
|
||||||
|
|
||||||
if ( $opt_debug )
|
if ( $opt_debug )
|
||||||
@ -4457,7 +4467,8 @@ sub run_testcase_start_servers($) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $clusters->[0]->{'pid'} and ! $master->[1]->{'pid'} and
|
if ( $clusters->[0]->{'pid'} || $clusters->[0]->{'use_running'}
|
||||||
|
and ! $master->[1]->{'pid'} and
|
||||||
$tinfo->{'master_num'} > 1 )
|
$tinfo->{'master_num'} > 1 )
|
||||||
{
|
{
|
||||||
# Test needs cluster, start an extra mysqld connected to cluster
|
# Test needs cluster, start an extra mysqld connected to cluster
|
||||||
|
Loading…
x
Reference in New Issue
Block a user