-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Galera MTR Tests: Test for GCF-942 - safe_to_bootstrap flag in grasta…
…te.dat
- Loading branch information
1 parent
3de28b4
commit e043029
Showing
2 changed files
with
189 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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; |
163 changes: 163 additions & 0 deletions
163
mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
# | ||
# 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; |