Commit be055b38 authored by Nirbhay Choubey's avatar Nirbhay Choubey

Minor improvements in mtr and wsrep test files.

parent e5267cae
......@@ -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
......
......@@ -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;
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)
}
# 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
......@@ -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 == $$ )
......@@ -2395,24 +2394,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 ((defined $ENV{'WSREP_PROVIDER'}) && ($ENV{'WSREP_PROVIDER'} ne "")) {
mtr_verbose("WSREP_PROVIDER set to $ENV{'WSREP_PROVIDER'}");
} else {
mtr_verbose("WSREP_PROVIDER isn't available");
}
}
# ----------------------------------------------------
# mysql clients
# ----------------------------------------------------
......@@ -3181,32 +3162,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";
}
}
}
}
......
--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
......
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