diff --git a/mysql-test/include/galera_init.inc b/mysql-test/include/galera_init.inc index 79591973862..7c79d6fc138 100644 --- a/mysql-test/include/galera_init.inc +++ b/mysql-test/include/galera_init.inc @@ -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 diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc index edb919fd852..4b322f769c7 100644 --- a/mysql-test/include/have_wsrep_enabled.inc +++ b/mysql-test/include/have_wsrep_enabled.inc @@ -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; diff --git a/mysql-test/include/have_wsrep_provider.inc b/mysql-test/include/have_wsrep_provider.inc new file mode 100644 index 00000000000..818abdd43b0 --- /dev/null +++ b/mysql-test/include/have_wsrep_provider.inc @@ -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) +} + diff --git a/mysql-test/include/wait_until_ready.inc b/mysql-test/include/wait_until_ready.inc new file mode 100644 index 00000000000..e7a6940975a --- /dev/null +++ b/mysql-test/include/wait_until_ready.inc @@ -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 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 651fb4f7bfb..758086b2aaa 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -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"; + } } } } diff --git a/mysql-test/r/have_wsrep.require b/mysql-test/r/have_wsrep_on.require similarity index 100% rename from mysql-test/r/have_wsrep.require rename to mysql-test/r/have_wsrep_on.require diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test index 99d34873512..d2035b28550 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.test +++ b/mysql-test/suite/wsrep/t/binlog_format.test @@ -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