Commit e043029a authored by Philip Stoev's avatar Philip Stoev Committed by Sachin Setiya

Galera MTR Tests: Test for GCF-942 - safe_to_bootstrap flag in grastate.dat

parent 3de28b42
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 1']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
SET SESSION wsrep_on = OFF;
Killing server ...
safe_to_bootstrap: 1
safe_to_bootstrap: 0
safe_to_bootstrap: 0
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Test the safe_to_bootstrap in grastate.dat
#
--source include/galera_cluster.inc
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
#
# At start, all grastate.dat files have safe_to_boostrap: 0
#
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0'
--let $assert_select= safe_to_bootstrap: 0
--let $assert_count= 1
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
--source include/assert_grep.inc
#
# Shut down one node
#
--connection node_2
--source include/shutdown_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Still, all grastate.dat files should have safe_to_boostrap: 0
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
--source include/assert_grep.inc
#
# Shut down one more node
#
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--source include/shutdown_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Now, nodes 2,3 should have safe_to_boostrap: 0
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
--source include/assert_grep.inc
# But node #1 should have safe_to_boostrap: 1
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 1'
--let $assert_select= safe_to_bootstrap: 1
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--source include/assert_grep.inc
# Restart one node
--connection node_2
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# All nodes should be back to 'safe_to_bootstrap: 0'
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0'
--let $assert_select= safe_to_bootstrap: 0
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--source include/assert_grep.inc
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
--source include/assert_grep.inc
#
# Kill the cluster
#
--connection node_2
--source include/shutdown_mysqld.inc
--connection node_1
SET SESSION wsrep_on = OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--source include/kill_galera.inc
#
# Only node #1 should have safe_to_bootstrap: 1
# include/assert_grep.inc requires a running server, so we revert to simple grep
#
--error 0
--exec grep 'safe_to_bootstrap: 1' $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--error 0
--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--error 0
--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat
#
# Attempt to bootstrap nodes #2, #3, should fail
#
--error 1
--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster | grep 'This node is not safe to bootstrap the cluster'
--error 1
--exec $MYSQLD --defaults-group-suffix=.3 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster | grep 'This node is not safe to bootstrap the cluster'
#
# Attempt to bootstrap starting from node #1, should succeed
#
--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
--connection node_3
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect
--source include/start_mysqld.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--connection node_2
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
--connection node_3
CALL mtr.add_suppression("Failed to prepare for incremental state transfer");
SHOW CREATE TABLE t1;
DROP TABLE t1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment