From 7196691b44b65e12cb5cca6f17c8d0f091eb443f Mon Sep 17 00:00:00 2001
From: Nirbhay Choubey <nirbhay@mariadb.com>
Date: Tue, 1 Nov 2016 17:20:12 -0400
Subject: [PATCH] Fix/disable some failing galera tests.

---
 mysql-test/suite/galera/disabled.def            |  4 +++-
 .../include/auto_increment_offset_restore.inc   |  6 ++++++
 .../include/auto_increment_offset_save.inc      |  8 ++++++++
 .../galera/r/galera_sst_xtrabackup-v2.result    |  3 ++-
 mysql-test/suite/galera/t/galera#414.test       |  1 +
 .../galera/t/galera_sst_xtrabackup-v2.test      | 10 ++++++++++
 .../suite/galera/t/galera_wan_restart_ist.test  | 17 +++++++++++++++--
 mysql-test/suite/galera_3nodes/disabled.def     |  2 ++
 8 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 4aa15d27661..771053778d3 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -28,4 +28,6 @@ galera_flush : mysql-wsrep/issues/229
 galera_transaction_read_only : mysql-wsrep/issues/229
 galera_gcs_fragment : Incorrect arguments to SET
 galera_flush_local : Fails sporadically
-galera_binlog_stmt_autoinc : TODO: investigate
\ No newline at end of file
+galera_binlog_stmt_autoinc : TODO: investigate
+galera_sst_xtrabackup-v2-options : TODO: Fix test case
+mysql-wsrep#33 : TODO: investigate
diff --git a/mysql-test/suite/galera/include/auto_increment_offset_restore.inc b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc
index 6218dfd6f2c..1248ed100ca 100644
--- a/mysql-test/suite/galera/include/auto_increment_offset_restore.inc
+++ b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc
@@ -32,4 +32,10 @@ if ($node_3)
 --connection $node_3
 --eval SET @@global.auto_increment_offset = $auto_increment_offset_node_3;
 }
+
+if ($node_4)
+{
+--connection $node_4
+--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_4;
+}
 --enable_query_log
diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc
index 3c4db3f381c..216c689ec8c 100644
--- a/mysql-test/suite/galera/include/auto_increment_offset_save.inc
+++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc
@@ -13,6 +13,8 @@
 #   Connection handle for 2nd node
 # $node_3 (optional)
 #   Connection handle for 3rd node
+# $node_4 (optional)
+#   Connection handle for 4th node
 
 if (!$node_1)
 {
@@ -35,3 +37,9 @@ if ($node_3)
   let $auto_increment_offset_node_3 = `SELECT @@global.auto_increment_offset`;
 }
 
+if ($node_4)
+{
+  --connection $node_4
+  let $auto_increment_offset_node_4 = `SELECT @@global.auto_increment_offset`;
+}
+
diff --git a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
index 750d73b615f..df2d9190a4b 100644
--- a/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
+++ b/mysql-test/suite/galera/r/galera_sst_xtrabackup-v2.result
@@ -277,7 +277,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
 INSERT INTO t1 VALUES ('node2_committed_before');
 INSERT INTO t1 VALUES ('node2_committed_before');
 COMMIT;
-SET GLOBAL debug = 'd,sync.alter_opened_table';
+SET GLOBAL debug_dbug = 'd,sync.alter_opened_table';
 ALTER TABLE t1 ADD COLUMN f2 INTEGER;
 SET wsrep_sync_wait = 0;
 Killing server ...
@@ -356,3 +356,4 @@ COUNT(*) = 0
 DROP TABLE t1;
 COMMIT;
 SET AUTOCOMMIT=ON;
+SET GLOBAL debug_dbug = $debug_orig;
diff --git a/mysql-test/suite/galera/t/galera#414.test b/mysql-test/suite/galera/t/galera#414.test
index b426e6510b6..0ee6dcac700 100644
--- a/mysql-test/suite/galera/t/galera#414.test
+++ b/mysql-test/suite/galera/t/galera#414.test
@@ -3,6 +3,7 @@
 #
 
 --source include/big_test.inc
+--source include/have_innodb.inc
 --source include/galera_cluster.inc
 
 # We perform the shutdown/restart sequence in here. If there was a crash during shutdown, MTR will detect it
diff --git a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
index c6823795e59..aac6822170a 100644
--- a/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
+++ b/mysql-test/suite/galera/t/galera_sst_xtrabackup-v2.test
@@ -2,8 +2,18 @@
 --source include/galera_cluster.inc
 --source include/have_innodb.inc
 
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--source include/auto_increment_offset_save.inc
+
 --source suite/galera/include/galera_st_shutdown_slave.inc
 --source suite/galera/include/galera_st_clean_slave.inc
 
 --source suite/galera/include/galera_st_kill_slave.inc
 --source suite/galera/include/galera_st_kill_slave_ddl.inc
+
+# Restore original auto_increment_offset values.
+--source include/auto_increment_offset_restore.inc
+
+--source include/galera_end.inc
diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.test b/mysql-test/suite/galera/t/galera_wan_restart_ist.test
index 42f63df3acc..1cf5d4c7f74 100644
--- a/mysql-test/suite/galera/t/galera_wan_restart_ist.test
+++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.test
@@ -12,6 +12,16 @@
 --source include/galera_cluster.inc
 --source include/have_innodb.inc
 
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--let $node_4=node_4
+--source include/auto_increment_offset_save.inc
+
 SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
 
 --connection node_1
@@ -21,11 +31,9 @@ INSERT INTO t1 VALUES (1);
 --connection node_2
 INSERT INTO t1 VALUES (2);
 
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
 --connection node_3
 INSERT INTO t1 VALUES (3);
 
---connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
 --connection node_4
 INSERT INTO t1 VALUES (4);
 
@@ -146,3 +154,8 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe
 
 --connection node_4
 CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
+
+# Restore original auto_increment_offset values.
+--source include/auto_increment_offset_restore.inc
+
+--source include/galera_end.inc
diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def
index fb23a81bfb8..ca55c41ff72 100644
--- a/mysql-test/suite/galera_3nodes/disabled.def
+++ b/mysql-test/suite/galera_3nodes/disabled.def
@@ -3,3 +3,5 @@ galera_evs_suspect_timeout : TODO: investigate
 galera_innobackupex_backup : TODO: investigate
 galera_slave_options_do :MDEV-8798
 galera_slave_options_ignore : MDEV-8798
+galera_pc_bootstrap : TODO: Investigate: Timeout in wait_condition.inc
+galera_pc_weight : Test times out