summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/wsrep
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mysql-test/suite/wsrep/README7
-rw-r--r--mysql-test/suite/wsrep/common.pm117
-rw-r--r--mysql-test/suite/wsrep/disabled.def17
-rw-r--r--mysql-test/suite/wsrep/include/check_galera_version.inc47
-rw-r--r--mysql-test/suite/wsrep/my.cnf10
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-20625.result5
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-22443.result3
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23081.result24
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23092.result13
-rw-r--r--mysql-test/suite/wsrep/r/MDEV-23466.result3
-rw-r--r--mysql-test/suite/wsrep/r/alter_table_innodb.result8
-rw-r--r--mysql-test/suite/wsrep/r/binlog_format.result61
-rw-r--r--mysql-test/suite/wsrep/r/foreign_key.result19
-rw-r--r--mysql-test/suite/wsrep/r/mdev_10186.result8
-rw-r--r--mysql-test/suite/wsrep/r/mdev_22681.result3
-rw-r--r--mysql-test/suite/wsrep/r/mdev_6832.result11
-rw-r--r--mysql-test/suite/wsrep/r/mdev_7798.result14
-rw-r--r--mysql-test/suite/wsrep/r/plugin.result3
-rw-r--r--mysql-test/suite/wsrep/r/pool_of_threads.result8
-rw-r--r--mysql-test/suite/wsrep/r/trans.result9
-rw-r--r--mysql-test/suite/wsrep/r/variables.result142
-rw-r--r--mysql-test/suite/wsrep/r/variables_debug.result143
-rw-r--r--mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff19
-rw-r--r--mysql-test/suite/wsrep/r/wsrep-recover-v25.result15
-rw-r--r--mysql-test/suite/wsrep/r/wsrep-recover.result64
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_on_basic.result50
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_rpl.result33
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result44
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_variables_sst_method.result61
-rw-r--r--mysql-test/suite/wsrep/r/wsrep_variables_wsrep_off.result39
-rw-r--r--mysql-test/suite/wsrep/suite.pm17
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-20625.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-20625.test10
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-22443.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-22443.test12
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23081.cnf9
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23081.combinations4
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23081.test57
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23092.test22
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23466.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/MDEV-23466.test10
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.test10
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.opt1
-rw-r--r--mysql-test/suite/wsrep/t/binlog_format.test48
-rw-r--r--mysql-test/suite/wsrep/t/foreign_key.opt1
-rw-r--r--mysql-test/suite/wsrep/t/foreign_key.test20
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.cnf15
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.test12
-rw-r--r--mysql-test/suite/wsrep/t/mdev_22681.cnf10
-rw-r--r--mysql-test/suite/wsrep/t/mdev_22681.test15
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/mdev_6832.test17
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/mdev_7798.test18
-rw-r--r--mysql-test/suite/wsrep/t/plugin.opt1
-rw-r--r--mysql-test/suite/wsrep/t/plugin.test8
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.opt1
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.test12
-rw-r--r--mysql-test/suite/wsrep/t/trans.opt1
-rw-r--r--mysql-test/suite/wsrep/t/trans.test14
-rw-r--r--mysql-test/suite/wsrep/t/variables.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/variables.test26
-rw-r--r--mysql-test/suite/wsrep/t/variables_debug.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/variables_debug.test28
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover-step.inc41
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations4
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover-v25.test119
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.cnf9
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.combinations4
-rw-r--r--mysql-test/suite/wsrep/t/wsrep-recover.test194
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_on_basic.opt1
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_on_basic.test47
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_rpl.cnf1
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_rpl.test44
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test38
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_sst_method.cnf7
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test50
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.test30
84 files changed, 2099 insertions, 0 deletions
diff --git a/mysql-test/suite/wsrep/README b/mysql-test/suite/wsrep/README
new file mode 100644
index 00000000..98809607
--- /dev/null
+++ b/mysql-test/suite/wsrep/README
@@ -0,0 +1,7 @@
+* 'wsrep' suite is designated for tests which do not require a multi-node
+ galera cluster.
+
+* As these tests are specific to wsrep-related functionalities, they must skip
+ on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF)
+ See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc
+
diff --git a/mysql-test/suite/wsrep/common.pm b/mysql-test/suite/wsrep/common.pm
new file mode 100644
index 00000000..54ce8826
--- /dev/null
+++ b/mysql-test/suite/wsrep/common.pm
@@ -0,0 +1,117 @@
+package wsrep::common;
+
+use base qw(Exporter);
+our @EXPORT= qw(wsrep_not_ok);
+
+use File::Basename;
+use Memoize;
+memoize 'wrong_wsrep_version';
+memoize 'check_garbd_support';
+memoize 'check_wsrep_support';
+memoize 'wsrep_not_ok';
+
+use mtr_report;
+
+my $extra_path;
+my $mariabackup_path;
+my $mariabackup_exe;
+my $garbd_exe;
+my $file_wsrep_provider;
+
+sub wrong_wsrep_version() {
+ my $check_version= dirname($My::SafeProcess::safe_process_cmd[0]) . '/wsrep_check_version';
+ my $checked = `$check_version -p`;
+ chomp($checked);
+ return $? ? $checked : undef;
+}
+
+sub which($) { return `sh -c "command -v $_[0]"` }
+
+sub check_garbd_support() {
+ my $wsrep_path= dirname($file_wsrep_provider);
+ $garbd_exe= ::mtr_file_exists($wsrep_path."/garb/garbd",
+ $wsrep_path."/../../bin/garb/garbd",
+ '/usr/bin/garbd');
+ $ENV{MTR_GARBD_EXE}= $garbd_exe if $garbd_exe;
+}
+
+sub check_wsrep_support() {
+ mtr_report(" - binaries built with wsrep patch");
+
+ # ADD scripts to $PATH to that wsrep_sst_* can be found
+ my ($spath) = grep { -f "$_/wsrep_sst_rsync"; } "$::bindir/scripts", $::path_client_bindir;
+ mtr_error("No SST scripts") unless $spath;
+ $ENV{PATH}="$spath:$ENV{PATH}";
+
+ # ADD mariadb client to path so that wsrep_notify_cmd can find mariadb
+ # client for loading the tables. (Don't assume each machine has mariadb installed)
+ my ($cpath) = grep { -f "$_/mariadb"; } "$::bindir/scripts", $::path_client_bindir;
+ mtr_error("No mariadb client found") unless $cpath;
+ $ENV{PATH}="$cpath:$ENV{PATH}" unless $cpath eq $spath;
+
+ # ADD my_print_defaults script path to path so that SST scripts can find it
+ my $my_print_defaults_exe=
+ ::mtr_exe_maybe_exists(
+ "$::bindir/extra/my_print_defaults",
+ "$::path_client_bindir/my_print_defaults");
+ my $epath= "";
+ if ($my_print_defaults_exe ne "") {
+ $epath= dirname($my_print_defaults_exe);
+ }
+ mtr_error("No my_print_defaults") unless $epath;
+ $ENV{PATH}="$epath:$ENV{PATH}" unless ($epath eq $spath) or
+ ($epath eq $cpath);
+
+ $extra_path= $epath;
+
+ if (which("socat")) {
+ $ENV{MTR_GALERA_TFMT}="socat";
+ } elsif (which("nc")) {
+ $ENV{MTR_GALERA_TFMT}="nc";
+ }
+
+ $ENV{PATH}=dirname($ENV{XTRABACKUP}).":$ENV{PATH}" if $ENV{XTRABACKUP};
+
+ # Check whether WSREP_PROVIDER environment variable is set.
+ if (defined $ENV{'WSREP_PROVIDER'}) {
+ $file_wsrep_provider= "";
+ if ($ENV{'WSREP_PROVIDER'} ne "none") {
+ if (::mtr_file_exists($ENV{'WSREP_PROVIDER'}) ne "") {
+ $file_wsrep_provider= $ENV{'WSREP_PROVIDER'};
+ } else {
+ mtr_error("WSREP_PROVIDER env set to an invalid path");
+ }
+ check_garbd_support();
+ }
+ # 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.
+ $file_wsrep_provider=
+ ::mtr_file_exists("/usr/lib64/galera-4/libgalera_smm.so",
+ "/usr/lib64/galera/libgalera_smm.so",
+ "/usr/lib/galera-4/libgalera_smm.so",
+ "/usr/lib/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;
+ check_garbd_support();
+ } else {
+ mtr_verbose("Could not find wsrep provider library, setting it to 'none'");
+ $ENV{'WSREP_PROVIDER'}= "none";
+ }
+ }
+}
+
+sub wsrep_not_ok() {
+ return "Not run for embedded server" if $::opt_embedded_server;
+ return "WSREP is not compiled in" if not $::mysqld_variables{'wsrep-on'};
+ check_wsrep_support();
+ return "No wsrep provider library" unless $file_wsrep_provider;
+ return wrong_wsrep_version() if wrong_wsrep_version();
+ undef;
+}
+
+1;
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
new file mode 100644
index 00000000..991109d7
--- /dev/null
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -0,0 +1,17 @@
+##############################################################################
+#
+# List the test cases that are to be disabled temporarily.
+#
+# Separate the test case name and the comment with ':'.
+#
+# <testcasename> : MDEV-<xxxx> <comment>
+#
+# Do not use any TAB characters for whitespace.
+#
+##############################################################################
+
+
+mdev_6832: wsrep_provider is read-only for security reasons
+MDEV-23092: wsrep_provider is read-only for security reasons
+wsrep_variables_no_provider: wsrep_provider is read-only for security reasons
+MDEV-22443: it is no longer allowed enable wsrep_on if wsrep_provider is 'none'
diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc
new file mode 100644
index 00000000..40cd157c
--- /dev/null
+++ b/mysql-test/suite/wsrep/include/check_galera_version.inc
@@ -0,0 +1,47 @@
+# ==== Purpose ====
+# Enable tests to check the galera library version.
+#
+# ==== Usage ====
+# --let $galera_version=3.6
+# source include/check_galera_lib_version.inc;
+#
+# Parameters:
+# $galera_version
+# Version of the galera library required by the test.
+#
+
+--disable_query_log
+
+# Required Version
+
+eval SET @GALERA_VERSION='$galera_version';
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\2') AS UNSIGNED) INTO @GALERA_MINOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@GALERA_VERSION,'^(\\d+)\\.(\\d+)\\.(\\d+).*','\\3') AS UNSIGNED) INTO @GALERA_RELEASE_VERSION;
+
+# Actual
+SELECT VARIABLE_VALUE INTO @ACTUAL_GALERA_VERSION FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version';
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^(\\d+)\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MAJOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*(\\d+)\\.\\d+.*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_MINOR_VERSION;
+SELECT CAST(REGEXP_REPLACE(@ACTUAL_GALERA_VERSION,'^[\\d\\.]*\\.(\\d+).*','\\1') AS UNSIGNED) INTO @ACTUAL_GALERA_RELEASE_VERSION;
+--enable_query_log
+
+# For testing
+#SELECT @GALERA_MAJOR_VERSION;
+#SELECT @GALERA_MINOR_VERSION;
+#SELECT @GALERA_RELEASE_VERSION;
+#SELECT @ACTUAL_GALERA_MAJOR_VERSION;
+#SELECT @ACTUAL_GALERA_MINOR_VERSION;
+#SELECT @ACTUAL_GALERA_RELEASE_VERSION;
+
+if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR
+ (@ACTUAL_GALERA_MINOR_VERSION = @GALERA_MINOR_VERSION AND
+ @ACTUAL_GALERA_RELEASE_VERSION >= @GALERA_RELEASE_VERSION)
+ `)
+{
+ let actual_galera_version=`select @ACTUAL_GALERA_VERSION`;
+ skip needs galera >= $galera_version, got $actual_galera_version;
+}
+
+--echo # Correct Galera library found
+
diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf
new file mode 100644
index 00000000..e35f73f4
--- /dev/null
+++ b/mysql-test/suite/wsrep/my.cnf
@@ -0,0 +1,10 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+wsrep-on=ON
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
diff --git a/mysql-test/suite/wsrep/r/MDEV-20625.result b/mysql-test/suite/wsrep/r/MDEV-20625.result
new file mode 100644
index 00000000..3e2b621c
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-20625.result
@@ -0,0 +1,5 @@
+SET GLOBAL wsrep_on=ON;
+SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
+Variable_name Value
+wsrep_cluster_size 0
+SET GLOBAL wsrep_on=OFF;
diff --git a/mysql-test/suite/wsrep/r/MDEV-22443.result b/mysql-test/suite/wsrep/r/MDEV-22443.result
new file mode 100644
index 00000000..ea07cbec
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-22443.result
@@ -0,0 +1,3 @@
+SET SESSION wsrep_sync_wait=15;
+SET SESSION wsrep_on=1;
+START TRANSACTION READ WRITE;
diff --git a/mysql-test/suite/wsrep/r/MDEV-23081.result b/mysql-test/suite/wsrep/r/MDEV-23081.result
new file mode 100644
index 00000000..5d0ad90b
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-23081.result
@@ -0,0 +1,24 @@
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+connect con1, localhost, root;
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+INSERT INTO t1 VALUES (9);
+connect con_ctrl, localhost, root;
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+connect con2, localhost, root;
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+INSERT INTO t1 VALUES (10);
+connection con_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+connection default;
+# Kill the server
+XA RECOVER;
+formatID gtrid_length bqual_length data
+disconnect con1;
+disconnect con2;
+disconnect con_ctrl;
+connection default;
+DROP TABLE t1;
+CALL mtr.add_suppression("You need to use --log-bin to make --binlog-format work");
diff --git a/mysql-test/suite/wsrep/r/MDEV-23092.result b/mysql-test/suite/wsrep/r/MDEV-23092.result
new file mode 100644
index 00000000..d88aacf7
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-23092.result
@@ -0,0 +1,13 @@
+SET COLLATION_CONNECTION='utf16le_bin';
+SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
+ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/'
+SET GLOBAL wsrep_cluster_address='OFF';
+SET GLOBAL wsrep_slave_threads=10;
+SELECT 1;
+1
+1
+SET GLOBAL wsrep_cluster_address='gcomm://';
+SET GLOBAL wsrep_slave_threads=DEFAULT;
+CALL mtr.add_suppression("wsrep_load()");
+CALL mtr.add_suppression("Failed to create a new provider");
+CALL mtr.add_suppression("Failed to load provider");
diff --git a/mysql-test/suite/wsrep/r/MDEV-23466.result b/mysql-test/suite/wsrep/r/MDEV-23466.result
new file mode 100644
index 00000000..a019704d
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/MDEV-23466.result
@@ -0,0 +1,3 @@
+SELECT WSREP_LAST_SEEN_GTID();
+WSREP_LAST_SEEN_GTID()
+0-0-0
diff --git a/mysql-test/suite/wsrep/r/alter_table_innodb.result b/mysql-test/suite/wsrep/r/alter_table_innodb.result
new file mode 100644
index 00000000..85017cec
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/alter_table_innodb.result
@@ -0,0 +1,8 @@
+#
+# MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
+#
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e;
+ALTER TABLE t1 MODIFY i FLOAT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/binlog_format.result b/mysql-test/suite/wsrep/r/binlog_format.result
new file mode 100644
index 00000000..079ceb97
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/binlog_format.result
@@ -0,0 +1,61 @@
+call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format");
+call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
+#
+# MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT
+#
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+SET binlog_format=STATEMENT;
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+SHOW WARNINGS;
+Level Code Message
+Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format STATEMENT
+CREATE TABLE IF NOT EXISTS test.t1 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+SET binlog_format=MIXED;
+Warnings:
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
+SHOW WARNINGS;
+Level Code Message
+Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format MIXED
+CREATE TABLE IF NOT EXISTS test.t2 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+SET binlog_format=ROW;
+SHOW WARNINGS;
+Level Code Message
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+CREATE TABLE IF NOT EXISTS test.t3 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+#
+# MDEV-7322: Option to allow setting the binlog_format with Galera
+#
+SET @@GLOBAL.binlog_format=STATEMENT;
+ERROR 42000: Variable 'binlog_format' can't be set to the value of 'STATEMENT'
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+SET @@GLOBAL.binlog_format=MIXED;
+ERROR 42000: Variable 'binlog_format' can't be set to the value of 'MIXED'
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+SET @@GLOBAL.binlog_format=DEFAULT;
+ERROR 42000: Variable 'binlog_format' can't be set to the value of 'DEFAULT'
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+SET @@GLOBAL.binlog_format=ROW;
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/foreign_key.result b/mysql-test/suite/wsrep/r/foreign_key.result
new file mode 100644
index 00000000..c8407480
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/foreign_key.result
@@ -0,0 +1,19 @@
+USE test;
+create table p(v varchar(20), i int, primary key(v,i)) engine=innodb character set = utf8;
+create table c(k int primary key, v varchar(20), i int, foreign key(v,i) references p(v,i)) engine=innodb character set = utf8;
+insert into p values (_utf32 0x000004100000041100000412, 1);
+insert into c values (1, _utf32 0x000004100000041100000412, 1);
+SELECT * FROM test.p;
+v i
+??? 1
+SELECT * FROM test.c;
+k v i
+1 ??? 1
+SELECT * FROM test.p;
+v i
+??? 1
+SELECT * FROM test.c;
+k v i
+1 ??? 1
+DROP TABLE c;
+DROP TABLE p;
diff --git a/mysql-test/suite/wsrep/r/mdev_10186.result b/mysql-test/suite/wsrep/r/mdev_10186.result
new file mode 100644
index 00000000..a21e77a2
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_10186.result
@@ -0,0 +1,8 @@
+#
+# MDEV-10186: mysqld crash when runtime setting
+# wsrep_cluster_address without wsrep_on=ON
+#
+SELECT @@wsrep_on;
+@@wsrep_on
+0
+SET @@GLOBAL.wsrep_cluster_address='gcomm://';
diff --git a/mysql-test/suite/wsrep/r/mdev_22681.result b/mysql-test/suite/wsrep/r/mdev_22681.result
new file mode 100644
index 00000000..ecce324e
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_22681.result
@@ -0,0 +1,3 @@
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b';
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/mdev_6832.result b/mysql-test/suite/wsrep/r/mdev_6832.result
new file mode 100644
index 00000000..43894a6e
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_6832.result
@@ -0,0 +1,11 @@
+#
+# MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
+#
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready ON
+SHOW STATUS LIKE 'wsrep_ready';
+Variable_name Value
+wsrep_ready OFF
+SET @@global.wsrep_cluster_address='gcomm://';
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/mdev_7798.result b/mysql-test/suite/wsrep/r/mdev_7798.result
new file mode 100644
index 00000000..ec906ccd
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/mdev_7798.result
@@ -0,0 +1,14 @@
+#
+# MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+# turned off
+#
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+SET GLOBAL WSREP_ON= 0;
+Restart the node.
+# restart
+SELECT @@GLOBAL.WSREP_ON;
+@@GLOBAL.WSREP_ON
+1
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/plugin.result b/mysql-test/suite/wsrep/r/plugin.result
new file mode 100644
index 00000000..4f52173c
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/plugin.result
@@ -0,0 +1,3 @@
+SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name;
+plugin_name plugin_version plugin_maturity
+wsrep 1.0 Stable
diff --git a/mysql-test/suite/wsrep/r/pool_of_threads.result b/mysql-test/suite/wsrep/r/pool_of_threads.result
new file mode 100644
index 00000000..ffe309f2
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/pool_of_threads.result
@@ -0,0 +1,8 @@
+
+#
+# MDEV#5687: Maria doesn't shutdown following upgrade to 5.5.35-galera
+#
+SELECT @@GLOBAL.thread_handling;
+@@GLOBAL.thread_handling
+pool-of-threads
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/trans.result b/mysql-test/suite/wsrep/r/trans.result
new file mode 100644
index 00000000..bc225897
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/trans.result
@@ -0,0 +1,9 @@
+#
+# MDEV-4222 : Assertion `( ((global_system_variables.wsrep_on) &&
+# (thd && thd->variables.wsrep_on)) && srep_emulate_bin_log)
+# || mysql_bin_log .is_open()' fails on SAVEPOINT with
+# disabled wsrep_provider
+#
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SAVEPOINT A;
+End of test.
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
new file mode 100644
index 00000000..2d5d5a66
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -0,0 +1,142 @@
+# Correct Galera library found
+SHOW GLOBAL STATUS LIKE 'wsrep%';
+Variable_name Value
+wsrep_local_state_uuid #
+wsrep_protocol_version #
+wsrep_last_committed #
+wsrep_replicated #
+wsrep_replicated_bytes #
+wsrep_repl_keys #
+wsrep_repl_keys_bytes #
+wsrep_repl_data_bytes #
+wsrep_repl_other_bytes #
+wsrep_received #
+wsrep_received_bytes #
+wsrep_local_commits #
+wsrep_local_cert_failures #
+wsrep_local_replays #
+wsrep_local_send_queue #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
+wsrep_local_send_queue_avg #
+wsrep_local_recv_queue #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
+wsrep_local_recv_queue_avg #
+wsrep_local_cached_downto #
+wsrep_flow_control_paused_ns #
+wsrep_flow_control_paused #
+wsrep_flow_control_sent #
+wsrep_flow_control_recv #
+wsrep_flow_control_active #
+wsrep_flow_control_requested #
+wsrep_cert_deps_distance #
+wsrep_apply_oooe #
+wsrep_apply_oool #
+wsrep_apply_window #
+wsrep_apply_waits #
+wsrep_commit_oooe #
+wsrep_commit_oool #
+wsrep_commit_window #
+wsrep_local_state #
+wsrep_local_state_comment #
+wsrep_cert_index_size #
+wsrep_causal_reads #
+wsrep_cert_interval #
+wsrep_open_transactions #
+wsrep_open_connections #
+wsrep_incoming_addresses #
+wsrep_cluster_weight #
+wsrep_desync_count #
+wsrep_evs_delayed #
+wsrep_evs_evict_list #
+wsrep_evs_repl_latency #
+wsrep_evs_state #
+wsrep_gcomm_uuid #
+wsrep_gmcast_segment #
+wsrep_applier_thread_count #
+wsrep_cluster_capabilities #
+wsrep_cluster_conf_id #
+wsrep_cluster_size #
+wsrep_cluster_state_uuid #
+wsrep_cluster_status #
+wsrep_connected #
+wsrep_local_bf_aborts #
+wsrep_local_index #
+wsrep_provider_capabilities #
+wsrep_provider_name #
+wsrep_provider_vendor #
+wsrep_provider_version #
+wsrep_ready #
+wsrep_rollbacker_thread_count #
+wsrep_thread_count #
+# Should show nothing.
+SHOW STATUS LIKE 'x';
+Variable_name Value
+SELECT @@global.wsrep_cluster_address;
+@@global.wsrep_cluster_address
+gcomm://
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
+SHOW STATUS LIKE 'threads_connected';
+Variable_name Value
+Threads_connected 1
+SHOW STATUS LIKE 'wsrep_thread_count';
+Variable_name Value
+wsrep_thread_count 2
+# variables
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
+VARIABLE_NAME
+WSREP_ALLOWLIST
+WSREP_AUTO_INCREMENT_CONTROL
+WSREP_CAUSAL_READS
+WSREP_CERTIFICATION_RULES
+WSREP_CERTIFY_NONPK
+WSREP_CLUSTER_ADDRESS
+WSREP_CLUSTER_NAME
+WSREP_CONVERT_LOCK_TO_TRX
+WSREP_DATA_HOME_DIR
+WSREP_DBUG_OPTION
+WSREP_DEBUG
+WSREP_DESYNC
+WSREP_DIRTY_READS
+WSREP_DRUPAL_282555_WORKAROUND
+WSREP_FORCED_BINLOG_FORMAT
+WSREP_GTID_DOMAIN_ID
+WSREP_GTID_MODE
+WSREP_GTID_SEQ_NO
+WSREP_IGNORE_APPLY_ERRORS
+WSREP_LOAD_DATA_SPLITTING
+WSREP_LOG_CONFLICTS
+WSREP_MAX_WS_ROWS
+WSREP_MAX_WS_SIZE
+WSREP_MODE
+WSREP_MYSQL_REPLICATION_BUNDLE
+WSREP_NODE_ADDRESS
+WSREP_NODE_INCOMING_ADDRESS
+WSREP_NODE_NAME
+WSREP_NOTIFY_CMD
+WSREP_ON
+WSREP_OSU_METHOD
+WSREP_PATCH_VERSION
+WSREP_PROVIDER
+WSREP_PROVIDER_OPTIONS
+WSREP_RECOVER
+WSREP_REJECT_QUERIES
+WSREP_RESTART_SLAVE
+WSREP_RETRY_AUTOCOMMIT
+WSREP_SLAVE_FK_CHECKS
+WSREP_SLAVE_THREADS
+WSREP_SLAVE_UK_CHECKS
+WSREP_SR_STORE
+WSREP_SST_AUTH
+WSREP_SST_DONOR
+WSREP_SST_DONOR_REJECTS_QUERIES
+WSREP_SST_METHOD
+WSREP_SST_RECEIVE_ADDRESS
+WSREP_START_POSITION
+WSREP_STATUS_FILE
+WSREP_SYNC_WAIT
+WSREP_TRX_FRAGMENT_SIZE
+WSREP_TRX_FRAGMENT_UNIT
diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result
new file mode 100644
index 00000000..2ce69827
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/variables_debug.result
@@ -0,0 +1,143 @@
+# Correct Galera library found
+SHOW GLOBAL STATUS LIKE 'wsrep%';
+Variable_name Value
+wsrep_local_state_uuid #
+wsrep_protocol_version #
+wsrep_last_committed #
+wsrep_replicated #
+wsrep_replicated_bytes #
+wsrep_repl_keys #
+wsrep_repl_keys_bytes #
+wsrep_repl_data_bytes #
+wsrep_repl_other_bytes #
+wsrep_received #
+wsrep_received_bytes #
+wsrep_local_commits #
+wsrep_local_cert_failures #
+wsrep_local_replays #
+wsrep_local_send_queue #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
+wsrep_local_send_queue_avg #
+wsrep_local_recv_queue #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
+wsrep_local_recv_queue_avg #
+wsrep_local_cached_downto #
+wsrep_flow_control_paused_ns #
+wsrep_flow_control_paused #
+wsrep_flow_control_sent #
+wsrep_flow_control_recv #
+wsrep_flow_control_active #
+wsrep_flow_control_requested #
+wsrep_cert_deps_distance #
+wsrep_apply_oooe #
+wsrep_apply_oool #
+wsrep_apply_window #
+wsrep_apply_waits #
+wsrep_commit_oooe #
+wsrep_commit_oool #
+wsrep_commit_window #
+wsrep_local_state #
+wsrep_local_state_comment #
+wsrep_cert_index_size #
+wsrep_causal_reads #
+wsrep_cert_interval #
+wsrep_open_transactions #
+wsrep_open_connections #
+wsrep_incoming_addresses #
+wsrep_cluster_weight #
+wsrep_debug_sync_waiters #
+wsrep_desync_count #
+wsrep_evs_delayed #
+wsrep_evs_evict_list #
+wsrep_evs_repl_latency #
+wsrep_evs_state #
+wsrep_gcomm_uuid #
+wsrep_gmcast_segment #
+wsrep_applier_thread_count #
+wsrep_cluster_capabilities #
+wsrep_cluster_conf_id #
+wsrep_cluster_size #
+wsrep_cluster_state_uuid #
+wsrep_cluster_status #
+wsrep_connected #
+wsrep_local_bf_aborts #
+wsrep_local_index #
+wsrep_provider_capabilities #
+wsrep_provider_name #
+wsrep_provider_vendor #
+wsrep_provider_version #
+wsrep_ready #
+wsrep_rollbacker_thread_count #
+wsrep_thread_count #
+# Should show nothing.
+SHOW STATUS LIKE 'x';
+Variable_name Value
+SELECT @@global.wsrep_cluster_address;
+@@global.wsrep_cluster_address
+gcomm://
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
+SHOW STATUS LIKE 'threads_connected';
+Variable_name Value
+Threads_connected 1
+SHOW STATUS LIKE 'wsrep_thread_count';
+Variable_name Value
+wsrep_thread_count 2
+# variables
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
+VARIABLE_NAME
+WSREP_ALLOWLIST
+WSREP_AUTO_INCREMENT_CONTROL
+WSREP_CAUSAL_READS
+WSREP_CERTIFICATION_RULES
+WSREP_CERTIFY_NONPK
+WSREP_CLUSTER_ADDRESS
+WSREP_CLUSTER_NAME
+WSREP_CONVERT_LOCK_TO_TRX
+WSREP_DATA_HOME_DIR
+WSREP_DBUG_OPTION
+WSREP_DEBUG
+WSREP_DESYNC
+WSREP_DIRTY_READS
+WSREP_DRUPAL_282555_WORKAROUND
+WSREP_FORCED_BINLOG_FORMAT
+WSREP_GTID_DOMAIN_ID
+WSREP_GTID_MODE
+WSREP_GTID_SEQ_NO
+WSREP_IGNORE_APPLY_ERRORS
+WSREP_LOAD_DATA_SPLITTING
+WSREP_LOG_CONFLICTS
+WSREP_MAX_WS_ROWS
+WSREP_MAX_WS_SIZE
+WSREP_MODE
+WSREP_MYSQL_REPLICATION_BUNDLE
+WSREP_NODE_ADDRESS
+WSREP_NODE_INCOMING_ADDRESS
+WSREP_NODE_NAME
+WSREP_NOTIFY_CMD
+WSREP_ON
+WSREP_OSU_METHOD
+WSREP_PATCH_VERSION
+WSREP_PROVIDER
+WSREP_PROVIDER_OPTIONS
+WSREP_RECOVER
+WSREP_REJECT_QUERIES
+WSREP_RESTART_SLAVE
+WSREP_RETRY_AUTOCOMMIT
+WSREP_SLAVE_FK_CHECKS
+WSREP_SLAVE_THREADS
+WSREP_SLAVE_UK_CHECKS
+WSREP_SR_STORE
+WSREP_SST_AUTH
+WSREP_SST_DONOR
+WSREP_SST_DONOR_REJECTS_QUERIES
+WSREP_SST_METHOD
+WSREP_SST_RECEIVE_ADDRESS
+WSREP_START_POSITION
+WSREP_STATUS_FILE
+WSREP_SYNC_WAIT
+WSREP_TRX_FRAGMENT_SIZE
+WSREP_TRX_FRAGMENT_UNIT
diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff
new file mode 100644
index 00000000..596abf9c
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff
@@ -0,0 +1,19 @@
+--- r/wsrep-recover-v25.result 2019-02-28 09:20:56.153775856 +0200
++++ r/wsrep-recover-v25.reject 2019-02-28 09:22:16.578113115 +0200
+@@ -12,4 +12,16 @@
+ SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+ expect 6
+ 6
++connect con1, localhost, root;
++SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue";
++INSERT INTO t1 VALUES (7);
++connection default;
++SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
++# Kill the server
++Expect seqno 6
++6
++Expect 5
++SELECT * FROM t1;
++f1
++5
+ DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25.result b/mysql-test/suite/wsrep/r/wsrep-recover-v25.result
new file mode 100644
index 00000000..c6e9246a
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25.result
@@ -0,0 +1,15 @@
+# Kill the server
+Expect seqno 1
+1
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+# Kill the server
+Expect seqno 3
+3
+INSERT INTO t1 VALUES (5);
+# Kill the server
+Expect seqno 5
+5
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 6
+6
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/wsrep-recover.result b/mysql-test/suite/wsrep/r/wsrep-recover.result
new file mode 100644
index 00000000..44b50a75
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep-recover.result
@@ -0,0 +1,64 @@
+# Kill the server
+Expect seqno 1
+1
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+# Kill the server
+Expect seqno 3
+3
+INSERT INTO t1 VALUES (5);
+# Kill the server
+Expect seqno 5
+5
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 6
+6
+connect con1, localhost, root;
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue";
+INSERT INTO t1 VALUES (7);
+connect con_ctrl, localhost, root;
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+connect con2, localhost, root;
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue";
+INSERT INTO t1 VALUES (8);
+connection con_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached";
+connection default;
+# Kill the server
+Expect seqno 6
+6
+disconnect con1;
+disconnect con2;
+disconnect con_ctrl;
+connection default;
+SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 7
+7
+connect con1, localhost, root;
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+INSERT INTO t1 VALUES (9);
+connect con_ctrl, localhost, root;
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+connect con2, localhost, root;
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+INSERT INTO t1 VALUES (10);
+connection con_ctrl;
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+connection default;
+# Kill the server
+Expect seqno 7
+7
+disconnect con1;
+disconnect con2;
+disconnect con_ctrl;
+connection default;
+SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+expect 8
+8
+Expect row 5
+SELECT * FROM t1;
+f1
+5
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/r/wsrep_on_basic.result b/mysql-test/suite/wsrep/r/wsrep_on_basic.result
new file mode 100644
index 00000000..b3186fa6
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_on_basic.result
@@ -0,0 +1,50 @@
+#
+# wsrep_on
+#
+# save the initial values
+SET @wsrep_on_global_saved = @@global.wsrep_on;
+SET @wsrep_on_session_saved = @@session.wsrep_on;
+# default
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
+SELECT @@session.wsrep_on;
+@@session.wsrep_on
+1
+
+# scope and valid values
+SET @@global.wsrep_on=OFF;
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+0
+SET @@global.wsrep_on=ON;
+SELECT @@global.wsrep_on;
+@@global.wsrep_on
+1
+SET @@session.wsrep_on=OFF;
+SELECT @@session.wsrep_on;
+@@session.wsrep_on
+0
+SET @@session.wsrep_on=ON;
+SELECT @@session.wsrep_on;
+@@session.wsrep_on
+1
+SET @@session.wsrep_on=default;
+SELECT @@session.wsrep_on;
+@@session.wsrep_on
+1
+
+# invalid values
+SET @@global.wsrep_on=NULL;
+ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL'
+SET @@global.wsrep_on='junk';
+ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk'
+SET @@session.wsrep_on=NULL;
+ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'NULL'
+SET @@session.wsrep_on='junk';
+ERROR 42000: Variable 'wsrep_on' can't be set to the value of 'junk'
+
+# restore the initial values
+SET @@global.wsrep_on = @wsrep_on_global_saved;
+SET @@session.wsrep_on = @wsrep_on_session_saved;
+# End of test
diff --git a/mysql-test/suite/wsrep/r/wsrep_rpl.result b/mysql-test/suite/wsrep/r/wsrep_rpl.result
new file mode 100644
index 00000000..0d8f7bd9
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_rpl.result
@@ -0,0 +1,33 @@
+include/master-slave.inc
+[connection master]
+#
+# MDEV-10714: Could not execute Delete_rows event on table;
+# wsrep_max_ws_rows exceeded. Error_Code 1180
+#
+connection master;
+connection slave;
+connection master;
+CREATE TABLE t1(i INT) ENGINE = INNODB;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
+INSERT INTO t1 VALUES(1), (2);
+connection slave;
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+connection slave;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
+connection master;
+DELETE FROM t1;
+connection slave;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+connection master;
+DROP TABLE t1;
+connection slave;
+connection master;
+SET @@GLOBAL.wsrep_max_ws_rows = 0;
+connection slave;
+SET @@GLOBAL.wsrep_max_ws_rows = 0;
+include/rpl_end.inc
+# End of test.
diff --git a/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result b/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result
new file mode 100644
index 00000000..ad35dc8d
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_variables_no_provider.result
@@ -0,0 +1,44 @@
+SELECT @@wsrep_on;
+@@wsrep_on
+1
+SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
+SET @wsrep_debug_saved = @@global.wsrep_debug;
+SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
+SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
+SET GLOBAL wsrep_provider=none;
+SET SESSION wsrep_trx_fragment_size=DEFAULT;
+ERROR HY000: Incorrect arguments to SET
+SELECT @@session.wsrep_trx_fragment_size;
+@@session.wsrep_trx_fragment_size
+0
+SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
+SHOW WARNINGS;
+Level Code Message
+Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
+Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET GLOBAL wsrep_debug=1;
+Warnings:
+Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
+SELECT @@global.wsrep_debug;
+@@global.wsrep_debug
+NONE
+SET GLOBAL wsrep_slave_threads=5;
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+5
+SET GLOBAL wsrep_desync=1;
+ERROR HY000: WSREP (galera) not started
+SELECT @@global.wsrep_desync;
+@@global.wsrep_desync
+0
+SET SESSION wsrep_trx_fragment_unit='rows';
+ERROR HY000: Incorrect arguments to SET
+SELECT @@session.wsrep_trx_fragment_unit;
+@@session.wsrep_trx_fragment_unit
+rows
+SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
+SET @@global.wsrep_debug = @wsrep_debug_saved;
diff --git a/mysql-test/suite/wsrep/r/wsrep_variables_sst_method.result b/mysql-test/suite/wsrep/r/wsrep_variables_sst_method.result
new file mode 100644
index 00000000..1c830d41
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_variables_sst_method.result
@@ -0,0 +1,61 @@
+SELECT @@wsrep_on;
+@@wsrep_on
+1
+SET @wsrep_sst_method_saved = @@global.wsrep_sst_method;
+/* test currently supported methods */
+SET GLOBAL wsrep_sst_method=DEFAULT;
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+rsync
+SET GLOBAL wsrep_sst_method='rsync';
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+rsync
+SET GLOBAL wsrep_sst_method='mysqldump';
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+mysqldump
+SET GLOBAL wsrep_sst_method='mariabackup';
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+mariabackup
+SET GLOBAL wsrep_sst_method='backup';
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup
+SET GLOBAL wsrep_sst_method='backup1.sh';
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup1.sh
+SET GLOBAL wsrep_sst_method='my method';
+ERROR 42000: Variable 'wsrep_sst_method' can't be set to the value of 'my method'
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup1.sh
+SHOW WARNINGS;
+Level Code Message
+Error 1231 Variable 'wsrep_sst_method' can't be set to the value of 'my method'
+SET GLOBAL wsrep_sst_method='/method';
+ERROR 42000: Variable 'wsrep_sst_method' can't be set to the value of '/method'
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup1.sh
+SHOW WARNINGS;
+Level Code Message
+Error 1231 Variable 'wsrep_sst_method' can't be set to the value of '/method'
+SET GLOBAL wsrep_sst_method='method!';
+ERROR 42000: Variable 'wsrep_sst_method' can't be set to the value of 'method!'
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup1.sh
+SHOW WARNINGS;
+Level Code Message
+Error 1231 Variable 'wsrep_sst_method' can't be set to the value of 'method!'
+SET GLOBAL wsrep_sst_method='method;';
+ERROR 42000: Variable 'wsrep_sst_method' can't be set to the value of 'method;'
+SELECT @@global.wsrep_sst_method;
+@@global.wsrep_sst_method
+backup1.sh
+SHOW WARNINGS;
+Level Code Message
+Error 1231 Variable 'wsrep_sst_method' can't be set to the value of 'method;'
diff --git a/mysql-test/suite/wsrep/r/wsrep_variables_wsrep_off.result b/mysql-test/suite/wsrep/r/wsrep_variables_wsrep_off.result
new file mode 100644
index 00000000..7cae89ea
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_variables_wsrep_off.result
@@ -0,0 +1,39 @@
+SELECT @@wsrep_on;
+@@wsrep_on
+0
+SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
+SET @wsrep_debug_saved = @@global.wsrep_debug;
+SET SESSION wsrep_trx_fragment_size=DEFAULT;
+ERROR HY000: Incorrect arguments to SET
+SELECT @@session.wsrep_trx_fragment_size;
+@@session.wsrep_trx_fragment_size
+0
+SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
+ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
+SHOW WARNINGS;
+Level Code Message
+Warning 1231 Cannot set 'wsrep_start_position' because wsrep is switched off or provider is not loaded
+Error 1231 Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:100'
+SELECT @@global.wsrep_start_position;
+@@global.wsrep_start_position
+00000000-0000-0000-0000-000000000000:-1
+SET GLOBAL wsrep_debug=1;
+Warnings:
+Warning 1231 Setting 'wsrep_debug' has no effect because wsrep is switched off
+SELECT @@global.wsrep_debug;
+@@global.wsrep_debug
+NONE
+SET GLOBAL wsrep_slave_threads=5;
+SELECT @@global.wsrep_slave_threads;
+@@global.wsrep_slave_threads
+5
+SET GLOBAL wsrep_desync=1;
+ERROR HY000: WSREP (galera) not started
+SELECT @@global.wsrep_desync;
+@@global.wsrep_desync
+0
+SET SESSION wsrep_trx_fragment_unit='rows';
+ERROR HY000: Incorrect arguments to SET
+SELECT @@session.wsrep_trx_fragment_unit;
+@@session.wsrep_trx_fragment_unit
+rows
diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm
new file mode 100644
index 00000000..2ee33d83
--- /dev/null
+++ b/mysql-test/suite/wsrep/suite.pm
@@ -0,0 +1,17 @@
+package My::Suite::WSREP;
+
+use lib 'suite';
+use wsrep::common;
+
+@ISA = qw(My::Suite);
+
+return wsrep_not_ok() if wsrep_not_ok();
+
+push @::global_suppressions,
+ (
+ qr(WSREP: Could not open saved state file for reading: .*),
+ qr(WSREP: Could not open state file for reading: .*),
+ qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
+ );
+
+bless { };
diff --git a/mysql-test/suite/wsrep/t/MDEV-20625.cnf b/mysql-test/suite/wsrep/t/MDEV-20625.cnf
new file mode 100644
index 00000000..75f8a25c
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-20625.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-20625.test b/mysql-test/suite/wsrep/t/MDEV-20625.test
new file mode 100644
index 00000000..2a537fe4
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-20625.test
@@ -0,0 +1,10 @@
+#
+# Check SHOW GLOBAL STATUS after dynamic setting WSREP=ON
+#
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+SET GLOBAL wsrep_on=ON;
+SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';
+SET GLOBAL wsrep_on=OFF;
diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.cnf b/mysql-test/suite/wsrep/t/MDEV-22443.cnf
new file mode 100644
index 00000000..851f2999
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-22443.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=none
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-22443.test b/mysql-test/suite/wsrep/t/MDEV-22443.test
new file mode 100644
index 00000000..674cb5ae
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-22443.test
@@ -0,0 +1,12 @@
+#
+# MDEV-22443: terminate called after throwing an instance of
+# 'wsrep::runtime_error' in std::terminate on START TRANSACTION
+#
+
+--source include/have_innodb.inc
+--source include/have_wsrep.inc
+--source include/have_binlog_format_row.inc
+
+SET SESSION wsrep_sync_wait=15;
+SET SESSION wsrep_on=1;
+START TRANSACTION READ WRITE;
diff --git a/mysql-test/suite/wsrep/t/MDEV-23081.cnf b/mysql-test/suite/wsrep/t/MDEV-23081.cnf
new file mode 100644
index 00000000..489c4385
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23081.cnf
@@ -0,0 +1,9 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+binlog-format=ROW
+innodb-flush-log-at-trx-commit=1
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+innodb-autoinc-lock-mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23081.combinations b/mysql-test/suite/wsrep/t/MDEV-23081.combinations
new file mode 100644
index 00000000..1ce3b45a
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23081.combinations
@@ -0,0 +1,4 @@
+[binlogon]
+log-bin
+
+[binlogoff]
diff --git a/mysql-test/suite/wsrep/t/MDEV-23081.test b/mysql-test/suite/wsrep/t/MDEV-23081.test
new file mode 100644
index 00000000..04305b22
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23081.test
@@ -0,0 +1,57 @@
+#
+# MDEV-23081: Stray XA transactions at startup
+# if node restarts with wsrep_on=OFF
+#
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_debug_sync.inc
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+
+#
+# Execute two inserts on block those after becoming
+# prepared, and before they are committed
+#
+--connect con1, localhost, root
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+--send INSERT INTO t1 VALUES (9)
+
+--connect con_ctrl, localhost, root
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+
+--connect con2, localhost, root
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+--send INSERT INTO t1 VALUES (10)
+
+--connection con_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+
+#
+# Kill the server
+#
+--connection default
+--source include/kill_mysqld.inc
+
+#
+# and restart it with wsrep-on=OFF
+#
+let $restart_noprint=2;
+--let $restart_parameters=--wsrep-on=OFF
+--source include/start_mysqld.inc
+
+#
+# Expect no prepared XA transactions to be reported
+#
+XA RECOVER;
+
+--disconnect con1
+--disconnect con2
+--disconnect con_ctrl
+--connection default
+
+DROP TABLE t1;
+CALL mtr.add_suppression("You need to use --log-bin to make --binlog-format work");
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.cnf b/mysql-test/suite/wsrep/t/MDEV-23092.cnf
new file mode 100644
index 00000000..851f2999
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23092.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=none
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23092.test b/mysql-test/suite/wsrep/t/MDEV-23092.test
new file mode 100644
index 00000000..92a6e392
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23092.test
@@ -0,0 +1,22 @@
+#
+# MDEV-23092: SIGABRT in wsrep::server_state::provider when setting
+# invalid wsrep_provider (on optimized builds)
+#
+
+--source include/have_innodb.inc
+--source include/have_wsrep.inc
+--source include/have_binlog_format_row.inc
+
+SET COLLATION_CONNECTION='utf16le_bin';
+--error 1231
+SET GLOBAL wsrep_provider='/invalid/path/libgalera_smm.so';
+SET GLOBAL wsrep_cluster_address='OFF';
+SET GLOBAL wsrep_slave_threads=10;
+SELECT 1;
+
+SET GLOBAL wsrep_cluster_address='gcomm://';
+SET GLOBAL wsrep_slave_threads=DEFAULT;
+
+CALL mtr.add_suppression("wsrep_load()");
+CALL mtr.add_suppression("Failed to create a new provider");
+CALL mtr.add_suppression("Failed to load provider");
diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.cnf b/mysql-test/suite/wsrep/t/MDEV-23466.cnf
new file mode 100644
index 00000000..851f2999
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23466.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=OFF
+binlog-format=ROW
+wsrep-provider=none
+wsrep-cluster-address='gcomm://'
+innodb_autoinc_lock_mode=2
diff --git a/mysql-test/suite/wsrep/t/MDEV-23466.test b/mysql-test/suite/wsrep/t/MDEV-23466.test
new file mode 100644
index 00000000..26152982
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/MDEV-23466.test
@@ -0,0 +1,10 @@
+#
+# MDEV-23466: SIGABRT in wsrep::server_state::provider on
+# SELECT WSREP_LAST_SEEN_GTID() on optimized builds
+#
+
+--source include/have_innodb.inc
+--source include/have_wsrep.inc
+--source include/have_binlog_format_row.inc
+
+SELECT WSREP_LAST_SEEN_GTID();
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.cnf b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
new file mode 100644
index 00000000..d8e27463
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
@@ -0,0 +1,12 @@
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
+
+[mysqld.1]
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.test b/mysql-test/suite/wsrep/t/alter_table_innodb.test
new file mode 100644
index 00000000..ca06be02
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/alter_table_innodb.test
@@ -0,0 +1,10 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-7374 : Losing connection to MySQL while running ALTER TABLE
+--echo #
+CREATE TABLE t1(i INT) ENGINE=INNODB;
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e;
+ALTER TABLE t1 MODIFY i FLOAT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/t/binlog_format.cnf b/mysql-test/suite/wsrep/t/binlog_format.cnf
new file mode 100644
index 00000000..7ec24c14
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/binlog_format.cnf
@@ -0,0 +1,8 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+innodb_autoinc_lock_mode=2
+
diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt
new file mode 100644
index 00000000..299096e5
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/binlog_format.opt
@@ -0,0 +1 @@
+--wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test
new file mode 100644
index 00000000..695859a2
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/binlog_format.test
@@ -0,0 +1,48 @@
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+call mtr.add_suppression("WSREP: MariaDB Galera does not support binlog format");
+call mtr.add_suppression("WSREP: Cannot get fake transaction ID from storage engine.");
+
+--echo #
+--echo # MDEV-4227: Galera server should stop crashing on setting binlog_format STATEMENT
+--echo #
+
+SHOW VARIABLES LIKE 'binlog_format';
+SET binlog_format=STATEMENT;
+SHOW WARNINGS;
+SHOW VARIABLES LIKE 'binlog_format';
+CREATE TABLE IF NOT EXISTS test.t1 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+SET binlog_format=MIXED;
+SHOW WARNINGS;
+SHOW VARIABLES LIKE 'binlog_format';
+CREATE TABLE IF NOT EXISTS test.t2 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+SET binlog_format=ROW;
+SHOW WARNINGS;
+SHOW VARIABLES LIKE 'binlog_format';
+CREATE TABLE IF NOT EXISTS test.t3 AS SELECT * FROM information_schema.routines WHERE 1 = 0;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+DROP TABLE IF EXISTS test.t3;
+
+--echo #
+--echo # MDEV-7322: Option to allow setting the binlog_format with Galera
+--echo #
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.binlog_format=STATEMENT;
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.binlog_format=MIXED;
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+
+-- error ER_WRONG_VALUE_FOR_VAR
+SET @@GLOBAL.binlog_format=DEFAULT;
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+
+SET @@GLOBAL.binlog_format=ROW;
+SHOW GLOBAL VARIABLES LIKE 'binlog_format';
+
+--echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/foreign_key.opt b/mysql-test/suite/wsrep/t/foreign_key.opt
new file mode 100644
index 00000000..e3f2470c
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/foreign_key.opt
@@ -0,0 +1 @@
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/foreign_key.test b/mysql-test/suite/wsrep/t/foreign_key.test
new file mode 100644
index 00000000..71f6076a
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/foreign_key.test
@@ -0,0 +1,20 @@
+--source include/have_wsrep_enabled.inc
+--source include/have_binlog_format_row.inc
+--source include/have_innodb.inc
+
+USE test;
+create table p(v varchar(20), i int, primary key(v,i)) engine=innodb character set = utf8;
+create table c(k int primary key, v varchar(20), i int, foreign key(v,i) references p(v,i)) engine=innodb character set = utf8;
+insert into p values (_utf32 0x000004100000041100000412, 1);
+insert into c values (1, _utf32 0x000004100000041100000412, 1);
+
+SELECT * FROM test.p;
+SELECT * FROM test.c;
+
+SELECT * FROM test.p;
+SELECT * FROM test.c;
+
+# Cleanup
+DROP TABLE c;
+DROP TABLE p;
+
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.cnf b/mysql-test/suite/wsrep/t/mdev_10186.cnf
new file mode 100644
index 00000000..284c8876
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_10186.cnf
@@ -0,0 +1,15 @@
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
+
+[mysqld.1]
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
+innodb_autoinc_lock_mode=2
+wsrep-provider=$WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test
new file mode 100644
index 00000000..0f0aa287
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_10186.test
@@ -0,0 +1,12 @@
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # MDEV-10186: mysqld crash when runtime setting
+--echo # wsrep_cluster_address without wsrep_on=ON
+--echo #
+
+SELECT @@wsrep_on;
+SET @@GLOBAL.wsrep_cluster_address='gcomm://';
+
diff --git a/mysql-test/suite/wsrep/t/mdev_22681.cnf b/mysql-test/suite/wsrep/t/mdev_22681.cnf
new file mode 100644
index 00000000..2f310476
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_22681.cnf
@@ -0,0 +1,10 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+log-bin
+binlog-format=ROW
+innodb-flush-log-at-trx-commit=1
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+innodb-autoinc-lock-mode=2
diff --git a/mysql-test/suite/wsrep/t/mdev_22681.test b/mysql-test/suite/wsrep/t/mdev_22681.test
new file mode 100644
index 00000000..ce1129c7
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_22681.test
@@ -0,0 +1,15 @@
+#
+# MDEV-22681: Server crashes in galera::ReplicatorSMM::CommitOrder::CommitOrder
+# or assertion failed in wsrep::transaction::before_prepare.
+#
+# EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b'
+# crashes the server if binlog is on (see mdev_22681.cnf for configuration).
+#
+--source include/have_wsrep.inc
+--source include/have_wsrep_provider.inc
+--source include/have_innodb.inc
+
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+EXECUTE IMMEDIATE 'CREATE OR REPLACE TABLE t1 ENGINE=InnoDB AS SELECT 1 AS b';
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.cnf b/mysql-test/suite/wsrep/t/mdev_6832.cnf
new file mode 100644
index 00000000..0bf01f81
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_6832.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+
diff --git a/mysql-test/suite/wsrep/t/mdev_6832.test b/mysql-test/suite/wsrep/t/mdev_6832.test
new file mode 100644
index 00000000..d5303ce3
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_6832.test
@@ -0,0 +1,17 @@
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # MDEV-6832: ER_LOCK_WAIT_TIMEOUT on SHOW STATUS
+--echo #
+
+SHOW STATUS LIKE 'wsrep_ready';
+--disable_query_log
+eval SET @@global.wsrep_provider='$WSREP_PROVIDER';
+--enable_query_log
+SHOW STATUS LIKE 'wsrep_ready';
+SET @@global.wsrep_cluster_address='gcomm://';
+--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
+--source include/wait_condition.inc
+--echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.cnf b/mysql-test/suite/wsrep/t/mdev_7798.cnf
new file mode 100644
index 00000000..0bf01f81
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address=gcomm://
+
diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test
new file mode 100644
index 00000000..b9938d93
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mdev_7798.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_binlog_format_row.inc
+
+--echo #
+--echo # MDEV-7798: mysql.server init script can't stop mysqld when WSREP is
+--echo # turned off
+--echo #
+
+SELECT @@GLOBAL.WSREP_ON;
+SET GLOBAL WSREP_ON= 0;
+
+--echo Restart the node.
+--source include/restart_mysqld.inc
+
+SELECT @@GLOBAL.WSREP_ON;
+
+--echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/plugin.opt b/mysql-test/suite/wsrep/t/plugin.opt
new file mode 100644
index 00000000..f043a4a2
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/plugin.opt
@@ -0,0 +1 @@
+--binlog_format=ROW --log-bin --wsrep-on=1 --innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/plugin.test b/mysql-test/suite/wsrep/t/plugin.test
new file mode 100644
index 00000000..73d605b0
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/plugin.test
@@ -0,0 +1,8 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+
+#
+# MDEV-7604: wsrep plugin lists its status as Unknown
+#
+
+SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; \ No newline at end of file
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt
new file mode 100644
index 00000000..e75bba66
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt
@@ -0,0 +1 @@
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads --wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.test b/mysql-test/suite/wsrep/t/pool_of_threads.test
new file mode 100644
index 00000000..8e95d0ca
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.test
@@ -0,0 +1,12 @@
+--source include/have_wsrep_enabled.inc
+--source include/have_binlog_format_row.inc
+
+--echo
+--echo #
+--echo # MDEV#5687: Maria doesn't shutdown following upgrade to 5.5.35-galera
+--echo #
+
+# Note: This test is to ensure that server shuts down properly.
+SELECT @@GLOBAL.thread_handling;
+
+--echo # End of test.
diff --git a/mysql-test/suite/wsrep/t/trans.opt b/mysql-test/suite/wsrep/t/trans.opt
new file mode 100644
index 00000000..a8b72174
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/trans.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/trans.test b/mysql-test/suite/wsrep/t/trans.test
new file mode 100644
index 00000000..d8c4a472
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/trans.test
@@ -0,0 +1,14 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-4222 : Assertion `( ((global_system_variables.wsrep_on) &&
+--echo # (thd && thd->variables.wsrep_on)) && srep_emulate_bin_log)
+--echo # || mysql_bin_log .is_open()' fails on SAVEPOINT with
+--echo # disabled wsrep_provider
+--echo #
+
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+SAVEPOINT A;
+
+--echo End of test.
diff --git a/mysql-test/suite/wsrep/t/variables.cnf b/mysql-test/suite/wsrep/t/variables.cnf
new file mode 100644
index 00000000..b1c96d26
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+binlog-format=ROW
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
new file mode 100644
index 00000000..c28638e7
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -0,0 +1,26 @@
+--source include/have_wsrep.inc
+--source include/force_restart.inc
+--source include/have_innodb.inc
+--source include/galera_no_debug_sync.inc
+
+--let $galera_version=26.4.11
+source include/check_galera_version.inc;
+
+source include/galera_variables_ok.inc;
+
+--replace_column 2 #
+SHOW GLOBAL STATUS LIKE 'wsrep%';
+
+--echo # Should show nothing.
+SHOW STATUS LIKE 'x';
+
+SELECT @@global.wsrep_cluster_address;
+SELECT @@global.wsrep_on;
+
+SHOW STATUS LIKE 'threads_connected';
+SHOW STATUS LIKE 'wsrep_thread_count';
+
+--echo # variables
+
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
+
diff --git a/mysql-test/suite/wsrep/t/variables_debug.cnf b/mysql-test/suite/wsrep/t/variables_debug.cnf
new file mode 100644
index 00000000..b1c96d26
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables_debug.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+binlog-format=ROW
diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test
new file mode 100644
index 00000000..5e90d61c
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables_debug.test
@@ -0,0 +1,28 @@
+--source include/have_wsrep.inc
+--source include/force_restart.inc
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+--source include/galera_have_debug_sync.inc
+
+--let $galera_version=26.4.11
+source include/check_galera_version.inc;
+
+source include/galera_variables_ok.inc;
+
+--replace_column 2 #
+SHOW GLOBAL STATUS LIKE 'wsrep%';
+
+--echo # Should show nothing.
+SHOW STATUS LIKE 'x';
+
+SELECT @@global.wsrep_cluster_address;
+SELECT @@global.wsrep_on;
+
+SHOW STATUS LIKE 'threads_connected';
+SHOW STATUS LIKE 'wsrep_thread_count';
+
+--echo # variables
+
+SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME;
+
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-step.inc b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc
new file mode 100644
index 00000000..22669438
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover-step.inc
@@ -0,0 +1,41 @@
+#
+# Macro to run wsrep recovery step. This is adapted from
+# suite/galera/include/galera_wsrep_recover.inc, with additional
+# option to pass binlog argument to recovery command. The macro
+# returns recovered position split in uuid and seqno parts.
+#
+# Arguments:
+#
+# wsrep_recover_binlog_opt - Binlog options to recovery command
+#
+# Return:
+#
+# wsrep_recover_start_position_uuid - UUID corresponding to recovered position
+# wsrep_recover_start_position_seqno - seqno corresponding to recovered position
+#
+
+--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.log --innodb --wsrep-recover $wsrep_recover_binlog_opt --core-file > $MYSQL_TMP_DIR/galera_wsrep_recover.log 2>&1
+
+--perl
+ use strict;
+ my $wsrep_start_position = `grep 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`;
+ chomp($wsrep_start_position);
+ die if $wsrep_start_position eq '';
+ open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die;
+ my ($uuid, $seqno) = split /:/, $wsrep_start_position;
+ print FILE "--let \$wsrep_recover_start_position_uuid = $uuid\n";
+ print FILE "--let \$wsrep_recover_start_position_seqno = $seqno\n";
+ close FILE;
+EOF
+
+--source $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
+
+if ($wsrep_recover_start_position_uuid == '') {
+ --die "Could not obtain start_position_uuid."
+}
+
+if ($wsrep_recover_start_position_seqno == '') {
+ --die "Could not obtain start_position_seqno."
+}
+
+--remove_file $MYSQL_TMP_DIR/galera_wsrep_start_position.inc
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf b/mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf
new file mode 100644
index 00000000..b1c96d26
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover-v25.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+binlog-format=ROW
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations b/mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations
new file mode 100644
index 00000000..1ce3b45a
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover-v25.combinations
@@ -0,0 +1,4 @@
+[binlogon]
+log-bin
+
+[binlogoff]
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-v25.test b/mysql-test/suite/wsrep/t/wsrep-recover-v25.test
new file mode 100644
index 00000000..743e2795
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover-v25.test
@@ -0,0 +1,119 @@
+#
+# Verify that the wsrep XID gets updated in InnoDB rollback segment
+# properly and can be recovered with --wsrep-recover
+#
+# The test runs the following scenarios:
+#
+# 1) The server is started but no SQL is run
+# 2) DDL is executed
+# 3) INSERT is executed
+# 4) Two INSERTs are executed so that the first one in order will be
+# blocked after certification and the second one before entering
+# commit order critical section.
+# 5) Two DMLs are executed so that the prepare step is run out of order.
+# Both transactions are blocked before commit order critical section.
+#
+# After each scenario server is killed and the recovered position
+# is validated.
+#
+
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_debug_sync.inc
+
+#
+# Binlog option for recovery run. This must be set in the test because
+# combinations file causes log-bin option to be set from command line,
+# not via my.cnf.
+#
+--let $log_bin = `SELECT @@log_bin`
+if ($log_bin) {
+--let $wsrep_recover_binlog_opt = --log-bin
+}
+
+#
+# Scenario 1
+# The expected recovered seqno is 1 corresponding to initial cluster
+# configuration change.
+#
+let $restart_noprint=2;
+
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 1
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Senario 2
+# The expected recovered seqno is 3 corresponding to two configuration
+# changes and CREATE TABLE
+#
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+let $restart_noprint=2;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 3
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Scenario 3
+# The expected recovered seqno is 5 corresponding to three configuration
+# changes, CREATE TABLE and INSERT.
+#
+# The expected wsrep_last_committed after the server is restarted is 6.
+#
+
+INSERT INTO t1 VALUES (5);
+let $restart_noprint=2;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 5
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Scenario 4
+#
+# The INSERT gets prepared but not committed.
+#
+# This scenario is not applicable if binlog is not on since the
+# commit is not 2PC.
+#
+# If binlog is on, the INSERT
+# should be rolled back during recovery phase since it has not yet
+# been logged into binlog.
+#
+if ($log_bin) {
+ --connect con1, localhost, root
+ SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue";
+ --send INSERT INTO t1 VALUES (7)
+
+ --connection default
+ let $restart_noprint=2;
+ SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached";
+ --source include/kill_mysqld.inc
+ --source wsrep-recover-step.inc
+ --echo Expect seqno 6
+ --echo $wsrep_recover_start_position_seqno
+ --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+ --source include/start_mysqld.inc
+ --source include/wait_wsrep_ready.inc
+ --echo Expect 5
+ SELECT * FROM t1;
+}
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.cnf b/mysql-test/suite/wsrep/t/wsrep-recover.cnf
new file mode 100644
index 00000000..19986cd9
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.cnf
@@ -0,0 +1,9 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+binlog-format=ROW
+innodb-flush-log-at-trx-commit=1
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+innodb-autoinc-lock-mode=2 \ No newline at end of file
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.combinations b/mysql-test/suite/wsrep/t/wsrep-recover.combinations
new file mode 100644
index 00000000..1ce3b45a
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.combinations
@@ -0,0 +1,4 @@
+[binlogon]
+log-bin
+
+[binlogoff]
diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.test b/mysql-test/suite/wsrep/t/wsrep-recover.test
new file mode 100644
index 00000000..75271e45
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep-recover.test
@@ -0,0 +1,194 @@
+#
+# Verify that the wsrep XID gets updated in InnoDB rollback segment
+# properly and can be recovered with --wsrep-recover
+#
+# The test runs the following scenarios:
+#
+# 1) The server is started but no SQL is run
+# 2) DDL is executed
+# 3) INSERT is executed
+# 4) Two INSERTs are executed so that the first one in order will be
+# blocked after certification and the second one before entering
+# commit order critical section.
+# 5) Two DMLs are executed so that the prepare step is run out of order.
+# Both transactions are blocked before commit order critical section.
+#
+# After each scenario server is killed and the recovered position
+# is validated.
+#
+
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/have_wsrep_provider.inc
+--source include/have_debug_sync.inc
+
+# Binlog option for recovery run. This must be set in the test because
+# combinations file causes log-bin option to be set from command line,
+# not via my.cnf.
+#
+--let $log_bin = `SELECT @@log_bin`
+if ($log_bin) {
+--let $wsrep_recover_binlog_opt = --log-bin
+}
+
+#
+# Scenario 1
+# The expected recovered seqno is 1 corresponding to initial cluster
+# configuration change.
+#
+let $restart_noprint=2;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 1
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Senario 2
+# The expected recovered seqno is 3 corresponding to two configuration
+# change events and CREATE TABLE.
+#
+let $restart_noprint=2;
+
+CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 3
+--echo $wsrep_recover_start_position_seqno
+
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+#
+# Scenario 3
+# The expected recovered seqno is 5 corresponding to three configuration
+# change events, CREATE TABLE and INSERT.
+#
+# The expected wsrep_last_committed after the server is restarted is 6.
+#
+let $restart_noprint=2;
+
+INSERT INTO t1 VALUES (5);
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 5
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Scenario 4
+#
+# This will cause the following
+#
+# Seqno 7 - the first INSERT is blocked after it is certified but before
+# it gets prepared
+# Seqno 8 - the second INSERT is blocked before it will be ordered for
+# commit, so it becomes prepared
+#
+# As an outcome, the recovery process should return seqno 6 because
+# the range of prepared transactions found after the crash recovery
+# is not continuous up to 8.
+#
+# The expected wsrep_last_committed after server is restarted is 7.
+#
+
+# Send INSERT which will block after certification
+--connect con1, localhost, root
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue";
+--send INSERT INTO t1 VALUES (7)
+
+--connect con_ctrl, localhost, root
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+
+# Send INSERT which will block before commit order critical section
+--connect con2, localhost, root
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue";
+--send INSERT INTO t1 VALUES (8)
+
+--connection con_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached";
+
+--connection default
+let $restart_noprint=2;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 6
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+--disconnect con1
+--disconnect con2
+--disconnect con_ctrl
+--connection default
+
+SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Scenario 5
+#
+# This scenario will run two INSERTs in parallel so that they are
+# prepared out of order. The execution is stopped before commit
+# and the server is killed.
+#
+# The transactions will be recovered from InnoDB but
+# will be rolled back:
+# - If binlog is on, the binlog acts as a transaction coordinator.
+# The transaction is not logged into binlog, so the transaction is rolled
+# back.
+# - If binlog is not on, the transaction is 1PC and the wsrep XID
+# is not persisted before commit is complete.
+#
+
+--connect con1, localhost, root
+SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification";
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1";
+--send INSERT INTO t1 VALUES (9)
+
+--connect con_ctrl, localhost, root
+SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached";
+
+--connect con2, localhost, root
+SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2";
+--send INSERT INTO t1 VALUES (10)
+
+--connection con_ctrl
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2";
+SET DEBUG_SYNC = "now SIGNAL continue_after_certification";
+SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1";
+
+--connection default
+let $restart_noprint=2;
+--source include/kill_mysqld.inc
+--source wsrep-recover-step.inc
+--echo Expect seqno 7
+
+--echo $wsrep_recover_start_position_seqno
+--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno
+--source include/start_mysqld.inc
+--source include/wait_wsrep_ready.inc
+
+--disconnect con1
+--disconnect con2
+--disconnect con_ctrl
+--connection default
+
+
+SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed';
+
+#
+# Final sanity check: The successful inserts into t1 should result single row
+#
+--echo Expect row 5
+SELECT * FROM t1;
+
+DROP TABLE t1;
diff --git a/mysql-test/suite/wsrep/t/wsrep_on_basic.opt b/mysql-test/suite/wsrep/t/wsrep_on_basic.opt
new file mode 100644
index 00000000..9da4dd32
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_on_basic.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --binlog_format=ROW --wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/wsrep_on_basic.test b/mysql-test/suite/wsrep/t/wsrep_on_basic.test
new file mode 100644
index 00000000..98062dbe
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_on_basic.test
@@ -0,0 +1,47 @@
+--source include/have_wsrep.inc
+--source include/have_wsrep_provider.inc
+--source include/have_innodb.inc
+
+--echo #
+--echo # wsrep_on
+--echo #
+
+--echo # save the initial values
+SET @wsrep_on_global_saved = @@global.wsrep_on;
+SET @wsrep_on_session_saved = @@session.wsrep_on;
+
+--echo # default
+SELECT @@global.wsrep_on;
+SELECT @@session.wsrep_on;
+
+--echo
+--echo # scope and valid values
+SET @@global.wsrep_on=OFF;
+SELECT @@global.wsrep_on;
+SET @@global.wsrep_on=ON;
+SELECT @@global.wsrep_on;
+
+SET @@session.wsrep_on=OFF;
+SELECT @@session.wsrep_on;
+SET @@session.wsrep_on=ON;
+SELECT @@session.wsrep_on;
+SET @@session.wsrep_on=default;
+SELECT @@session.wsrep_on;
+
+--echo
+--echo # invalid values
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_on=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@global.wsrep_on='junk';
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_on=NULL;
+--error ER_WRONG_VALUE_FOR_VAR
+SET @@session.wsrep_on='junk';
+
+--echo
+--echo # restore the initial values
+SET @@global.wsrep_on = @wsrep_on_global_saved;
+SET @@session.wsrep_on = @wsrep_on_session_saved;
+
+--echo # End of test
diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.cnf b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf
new file mode 100644
index 00000000..56e874f2
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf
@@ -0,0 +1 @@
+!include ../../rpl/my.cnf
diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test
new file mode 100644
index 00000000..4f34aadc
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test
@@ -0,0 +1,44 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # MDEV-10714: Could not execute Delete_rows event on table;
+--echo # wsrep_max_ws_rows exceeded. Error_Code 1180
+--echo #
+# Save wsrep_max_ws_rows on master and slave.
+connection master;
+let $wsrep_max_ws_rows_master = `SELECT @@GLOBAL.wsrep_max_ws_rows`;
+connection slave;
+let $wsrep_max_ws_rows_slave = `SELECT @@GLOBAL.wsrep_max_ws_rows`;
+
+connection master;
+CREATE TABLE t1(i INT) ENGINE = INNODB;
+
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
+INSERT INTO t1 VALUES(1), (2);
+sync_slave_with_master;
+SELECT COUNT(*) = 2 FROM t1;
+
+connection slave;
+SET @@GLOBAL.wsrep_max_ws_rows = 2;
+
+connection master;
+DELETE FROM t1;
+
+sync_slave_with_master;
+SELECT COUNT(*) = 0 FROM t1;
+
+connection master;
+DROP TABLE t1;
+
+sync_slave_with_master;
+# Restore wsrep_max_ws_rows on master and slave
+connection master;
+eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_master;
+connection slave;
+eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_slave;
+
+--source include/rpl_end.inc
+--echo # End of test.
+
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf
new file mode 100644
index 00000000..b73146d2
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.cnf
@@ -0,0 +1,12 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld.1]
+wsrep-on=ON
+binlog-format=ROW
+wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-cluster-address='gcomm://'
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test
new file mode 100644
index 00000000..b44c9c5e
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_no_provider.test
@@ -0,0 +1,38 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+
+SELECT @@wsrep_on;
+
+SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
+SET @wsrep_debug_saved = @@global.wsrep_debug;
+SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
+SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
+
+SET GLOBAL wsrep_provider=none;
+
+--error ER_WRONG_ARGUMENTS
+SET SESSION wsrep_trx_fragment_size=DEFAULT;
+SELECT @@session.wsrep_trx_fragment_size;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
+SHOW WARNINGS;
+SELECT @@global.wsrep_start_position;
+SET GLOBAL wsrep_debug=1;
+SELECT @@global.wsrep_debug;
+SET GLOBAL wsrep_slave_threads=5;
+SELECT @@global.wsrep_slave_threads;
+--error ER_WRONG_ARGUMENTS
+SET GLOBAL wsrep_desync=1;
+SELECT @@global.wsrep_desync;
+--error ER_WRONG_ARGUMENTS
+SET SESSION wsrep_trx_fragment_unit='rows';
+SELECT @@session.wsrep_trx_fragment_unit;
+
+--disable_query_log
+eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
+SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
+SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
+--source include/galera_wait_ready.inc
+SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
+SET @@global.wsrep_debug = @wsrep_debug_saved;
+--enable_query_log
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.cnf
new file mode 100644
index 00000000..b1c96d26
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.cnf
@@ -0,0 +1,7 @@
+!include ../my.cnf
+
+[mysqld.1]
+wsrep-on=ON
+wsrep-cluster-address=gcomm://
+wsrep-provider=@ENV.WSREP_PROVIDER
+binlog-format=ROW
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test
new file mode 100644
index 00000000..b4171879
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test
@@ -0,0 +1,50 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+
+SELECT @@wsrep_on;
+
+SET @wsrep_sst_method_saved = @@global.wsrep_sst_method;
+
+/* test currently supported methods */
+SET GLOBAL wsrep_sst_method=DEFAULT;
+SELECT @@global.wsrep_sst_method;
+
+SET GLOBAL wsrep_sst_method='rsync';
+SELECT @@global.wsrep_sst_method;
+
+SET GLOBAL wsrep_sst_method='mysqldump';
+SELECT @@global.wsrep_sst_method;
+
+SET GLOBAL wsrep_sst_method='mariabackup';
+SELECT @@global.wsrep_sst_method;
+
+SET GLOBAL wsrep_sst_method='backup';
+SELECT @@global.wsrep_sst_method;
+
+SET GLOBAL wsrep_sst_method='backup1.sh';
+SELECT @@global.wsrep_sst_method;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_sst_method='my method';
+SELECT @@global.wsrep_sst_method;
+SHOW WARNINGS;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_sst_method='/method';
+SELECT @@global.wsrep_sst_method;
+SHOW WARNINGS;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_sst_method='method!';
+SELECT @@global.wsrep_sst_method;
+SHOW WARNINGS;
+
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_sst_method='method;';
+SELECT @@global.wsrep_sst_method;
+SHOW WARNINGS;
+
+
+--disable_query_log
+SET @@global.wsrep_sst_method = @wsrep_sst_method_saved;
+--enable_query_log
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf
new file mode 100644
index 00000000..2e66b1ef
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf
@@ -0,0 +1,12 @@
+# Use default setting for mysqld processes
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=OFF
+
+[mysqld.1]
+wsrep-on=OFF
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+
diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.test b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.test
new file mode 100644
index 00000000..4a9cd2ba
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.test
@@ -0,0 +1,30 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+
+SELECT @@wsrep_on;
+
+SET @wsrep_slave_threads_global_saved = @@global.wsrep_slave_threads;
+SET @wsrep_debug_saved = @@global.wsrep_debug;
+
+--error ER_WRONG_ARGUMENTS
+SET SESSION wsrep_trx_fragment_size=DEFAULT;
+SELECT @@session.wsrep_trx_fragment_size;
+--error ER_WRONG_VALUE_FOR_VAR
+SET GLOBAL wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
+SHOW WARNINGS;
+SELECT @@global.wsrep_start_position;
+SET GLOBAL wsrep_debug=1;
+SELECT @@global.wsrep_debug;
+SET GLOBAL wsrep_slave_threads=5;
+SELECT @@global.wsrep_slave_threads;
+--error ER_WRONG_ARGUMENTS
+SET GLOBAL wsrep_desync=1;
+SELECT @@global.wsrep_desync;
+--error ER_WRONG_ARGUMENTS
+SET SESSION wsrep_trx_fragment_unit='rows';
+SELECT @@session.wsrep_trx_fragment_unit;
+
+--disable_query_log
+SET @@global.wsrep_slave_threads = @wsrep_slave_threads_global_saved;
+SET @@global.wsrep_debug = @wsrep_debug_saved;
+--enable_query_log