Minor improvements in mtr and wsrep test files.

This commit is contained in:
Nirbhay Choubey 2014-09-09 19:19:12 -04:00
parent 4ffccff45d
commit 76d15afb33
7 changed files with 69 additions and 41 deletions

View file

@ -11,6 +11,7 @@
# Number of nodes in the cluster.
#
--source include/have_wsrep_provider.inc
--source include/have_wsrep_enabled.inc
--let $_galera_node= $galera_cluster_size

View file

@ -3,7 +3,7 @@
--source include/have_wsrep.inc
--require r/have_wsrep.require
--require r/have_wsrep_on.require
disable_query_log;
SHOW VARIABLES LIKE 'wsrep_on';
enable_query_log;

View file

@ -0,0 +1,6 @@
if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE
VARIABLE_NAME LIKE 'wsrep_provider' AND VARIABLE_VALUE NOT LIKE 'none'`)
{
--skip Test requires wsrep provider library (libgalera_smm.so)
}

View file

@ -0,0 +1,34 @@
# If wsrep patch is enabled, wait for a minute until node is ready.
# Note: include/wait_for_status_var.inc cannot be used here, as server rejects
# all commands except SHOW & SET until its ready. (see wsrep_ready status
# variable)
--disable_result_log
--disable_query_log
--enable_reconnect
let $counter= 600;
# Check if wsrep_ready status variable exists.
if (`SHOW STATUS LIKE 'wsrep_ready'`)
{
let $wsrep_ready= query_get_value("SHOW STATUS LIKE 'wsrep_ready'", Value, 1);
while ($wsrep_ready == 'OFF')
{
if (!$counter)
{
echo ===============================================;
echo Node still not ready after a minute, giving up!;
echo ===============================================;
die;
}
dec $counter;
sleep 0.1;
let $wsrep_ready= query_get_value("SHOW STATUS LIKE 'wsrep_ready'", Value, 1);
}
}
--disable_reconnect
--enable_query_log
--enable_result_log

View file

@ -135,7 +135,6 @@ my $opt_start;
my $opt_start_dirty;
my $opt_start_exit;
my $start_only;
my $file_wsrep_provider;
END {
if ( defined $opt_tmpdir_pid and $opt_tmpdir_pid == $$ )
@ -2399,24 +2398,6 @@ sub environment_setup {
$ENV{'NDB_EXAMPLES_OUTPUT'}= $path_ndb_testrun_log;
}
# ----------------------------------------------------
# Setup env for wsrep
# ----------------------------------------------------
if (have_wsrep()) {
if (defined $ENV{'WSREP_PROVIDER'} ) {
# Nothing needs to be done! WSREP_PROVIDER env is already set & checked;
# will be used.
} else {
$ENV{'WSREP_PROVIDER'}= $file_wsrep_provider;
}
if ($ENV{'WSREP_PROVIDER'} ne "") {
mtr_verbose("WSREP_PROVIDER set to $ENV{'WSREP_PROVIDER'}");
} else {
mtr_verbose("WSREP_PROVIDER isn't available");
}
}
# ----------------------------------------------------
# mysql clients
# ----------------------------------------------------
@ -3199,32 +3180,38 @@ sub have_wsrep() {
return defined $wsrep_on
}
sub check_wsrep_provider_env {
if (defined $ENV{'WSREP_PROVIDER'}) {
if (mtr_file_exists($ENV{'WSREP_PROVIDER'}) eq "") {
mtr_error("WSREP_PROVIDER env set to an invalid path");
return 0; # error
}
# Ok, WSREP_PROVIDER set to a valid path.
return 1;
}
# Ok, WSREP_PROVIDER not defined.
return 2;
}
sub check_wsrep_support() {
if (have_wsrep())
{
mtr_report(" - binaries built with wsrep patch");
$file_wsrep_provider=
mtr_file_exists("/usr/lib/galera/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so");
# Add galera test suites
mtr_report(" - adding wsrep, galera to default test suites");
push @DEFAULT_SUITES, qw(wsrep galera);
if ((check_wsrep_provider_env() == 1) || ($file_wsrep_provider ne "")) {
# Add galera test suites
mtr_report(" - adding wsrep, galera to default test suites");
push @DEFAULT_SUITES, qw(wsrep galera);
# Check whether WSREP_PROVIDER environment variable is set.
if (defined $ENV{'WSREP_PROVIDER'}) {
if ((mtr_file_exists($ENV{'WSREP_PROVIDER'}) eq "") &&
($ENV{'WSREP_PROVIDER'} ne "none")) {
mtr_error("WSREP_PROVIDER env set to an invalid path");
}
# WSREP_PROVIDER is valid; set to a valid path or "none").
mtr_verbose("WSREP_PROVIDER env set to $ENV{'WSREP_PROVIDER'}");
} else {
# WSREP_PROVIDER env not defined. Lets try to locate the wsrep provider
# library.
my $file_wsrep_provider=
mtr_file_exists("/usr/lib/galera/libgalera_smm.so",
"/usr/lib64/galera/libgalera_smm.so");
if ($file_wsrep_provider ne "") {
# wsrep provider library found !
mtr_verbose("wsrep provider library found : $file_wsrep_provider");
$ENV{'WSREP_PROVIDER'}= $file_wsrep_provider;
} else {
mtr_verbose("Could not find wsrep provider library, setting it to 'none'");
$ENV{'WSREP_PROVIDER'}= "none";
}
}
}
}

View file

@ -1,4 +1,4 @@
--source include/have_wsrep_enabled.inc
--source include/have_wsrep_provider.inc
--source include/have_binlog_format_row.inc
#
# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT