Skip to content
Permalink
Browse files

Galera MTR Tests: Tests for GAL-419 Respect safe_to_bootstrap flag al…

…so with

gcomm://

Signed-off-by: Sachin Setiya <sachinsetia1001@gmail.com>
  • Loading branch information...
SachinSetiya committed Mar 14, 2017
1 parent 108fd77 commit 16e683fdad2595b37388f9320d76930cbe425a52
@@ -0,0 +1,4 @@
SET SESSION wsrep_sync_wait = 0;
Killing server ...
SET SESSION wsrep_sync_wait = 0;
Killing server ...
@@ -26,6 +26,28 @@ VARIABLE_VALUE = 'Primary'
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1';
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
COUNT(*) > 0
1
SHOW STATUS LIKE 'wsrep_ready';
Variable_name Value
wsrep_ready ON
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status Primary
SHOW STATUS LIKE 'wsrep_local_state';
Variable_name Value
wsrep_local_state 4
SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Synced
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary'
1
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
CALL mtr.add_suppression("Backend not supported: foo");
CALL mtr.add_suppression("Failed to initialize backend using 'foo");
CALL mtr.add_suppression("Failed to open channel 'my_wsrep_cluster' at 'foo");
@@ -36,4 +58,5 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7");
# End of test
@@ -0,0 +1,35 @@
#
# GAL-419 safe_to_bootstrap: boostrap using wsrep_cluster_address=gcomm:// not prevented
#

--source include/galera_cluster.inc
--source include/big_test.inc

--connection node_2
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc

--connection node_1
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc

--sleep 2

# Node #1 has wsrep_cluster_address=gcomm:// in my.cnf, so should fail to bootstrap

--error 1
--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf | grep 'This node is not safe to bootstrap the cluster'

# Unless we remove grastate.dat

--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat

--connection node_1
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc

--connection node_2
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
@@ -58,6 +58,41 @@ SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';

#
# Set to invalid host
#

--connection node_2
SET GLOBAL wsrep_cluster_address = 'gcomm://192.0.2.1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc

--error 0
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS;

# Must return 'OFF'
SHOW STATUS LIKE 'wsrep_ready';

# Must return 'Non-primary'
SHOW STATUS LIKE 'wsrep_cluster_status';

# Must return 0 = 'Initialized'
SHOW STATUS LIKE 'wsrep_local_state';
SHOW STATUS LIKE 'wsrep_local_state_comment';

#
# Reset everything as it was
#

--connection node_2
--disable_query_log
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_node2';
--enable_query_log

--connection node_1
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';

--connection node_2
CALL mtr.add_suppression("Backend not supported: foo");
CALL mtr.add_suppression("Failed to initialize backend using 'foo");
@@ -69,7 +104,7 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");

CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7");
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc

0 comments on commit 16e683f

Please sign in to comment.
You can’t perform that action at this time.