| 1 |
# |
| 2 |
# Test the safe_to_bootstrap in grastate.dat |
| 3 |
# |
| 4 |
--source include/galera_cluster.inc |
| 5 |
--source include/force_restart.inc |
| 6 |
|
| 7 |
# |
| 8 |
# Create connection node_3 and save auto increment variables. |
| 9 |
# |
| 10 |
--let $galera_connection_name = node_3 |
| 11 |
--let $galera_server_number = 3 |
| 12 |
--source include/galera_connect.inc |
| 13 |
|
| 14 |
--let $node_1 = node_1 |
| 15 |
--let $node_2 = node_2 |
| 16 |
--let $node_3 = node_3 |
| 17 |
--source ../galera/include/auto_increment_offset_save.inc |
| 18 |
|
| 19 |
--connection node_1 |
| 20 |
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 21 |
INSERT INTO t1 VALUES (1); |
| 22 |
|
| 23 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 24 |
--source include/wait_condition.inc |
| 25 |
|
| 26 |
# |
| 27 |
# At start, all grastate.dat files have safe_to_boostrap: 0 |
| 28 |
# |
| 29 |
|
| 30 |
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0' |
| 31 |
--let $assert_select= safe_to_bootstrap: 0 |
| 32 |
--let $assert_count= 1 |
| 33 |
|
| 34 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat |
| 35 |
--source include/assert_grep.inc |
| 36 |
|
| 37 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat |
| 38 |
--source include/assert_grep.inc |
| 39 |
|
| 40 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 41 |
--source include/assert_grep.inc |
| 42 |
|
| 43 |
# |
| 44 |
# Shut down one node |
| 45 |
# |
| 46 |
|
| 47 |
--connection node_2 |
| 48 |
--source include/shutdown_mysqld.inc |
| 49 |
|
| 50 |
--connection node_1 |
| 51 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 52 |
--source include/wait_condition.inc |
| 53 |
|
| 54 |
# Still, all grastate.dat files should have safe_to_boostrap: 0 |
| 55 |
|
| 56 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat |
| 57 |
--source include/assert_grep.inc |
| 58 |
|
| 59 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat |
| 60 |
--source include/assert_grep.inc |
| 61 |
|
| 62 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 63 |
--source include/assert_grep.inc |
| 64 |
|
| 65 |
# |
| 66 |
# Shut down one more node |
| 67 |
# |
| 68 |
|
| 69 |
--connection node_3 |
| 70 |
--source include/shutdown_mysqld.inc |
| 71 |
|
| 72 |
--connection node_1 |
| 73 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 74 |
--source include/wait_condition.inc |
| 75 |
|
| 76 |
# Now, nodes 2,3 should have safe_to_boostrap: 0 |
| 77 |
|
| 78 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat |
| 79 |
--source include/assert_grep.inc |
| 80 |
|
| 81 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 82 |
--source include/assert_grep.inc |
| 83 |
|
| 84 |
# But node #1 should have safe_to_boostrap: 1 |
| 85 |
|
| 86 |
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 1' |
| 87 |
--let $assert_select= safe_to_bootstrap: 1 |
| 88 |
|
| 89 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat |
| 90 |
--source include/assert_grep.inc |
| 91 |
|
| 92 |
# Restart one node |
| 93 |
--connection node_2 |
| 94 |
let $restart_noprint=2; |
| 95 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect |
| 96 |
--source include/start_mysqld.inc |
| 97 |
|
| 98 |
--connection node_1 |
| 99 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 100 |
--source include/wait_condition.inc |
| 101 |
|
| 102 |
# All nodes should be back to 'safe_to_bootstrap: 0' |
| 103 |
|
| 104 |
--let $assert_text= grastate.dat does not have 'safe_to_bootstrap: 0' |
| 105 |
--let $assert_select= safe_to_bootstrap: 0 |
| 106 |
|
| 107 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat |
| 108 |
--source include/assert_grep.inc |
| 109 |
|
| 110 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat |
| 111 |
--source include/assert_grep.inc |
| 112 |
|
| 113 |
--let $assert_file= $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 114 |
--source include/assert_grep.inc |
| 115 |
|
| 116 |
# |
| 117 |
# Kill the cluster |
| 118 |
# |
| 119 |
|
| 120 |
--connection node_2 |
| 121 |
--source include/shutdown_mysqld.inc |
| 122 |
|
| 123 |
--connection node_1 |
| 124 |
SET SESSION wsrep_on = OFF; |
| 125 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 126 |
--source include/wait_condition.inc |
| 127 |
|
| 128 |
--source ../galera/include/kill_galera.inc |
| 129 |
|
| 130 |
# |
| 131 |
# Only node #1 should have safe_to_bootstrap: 1 |
| 132 |
# include/assert_grep.inc requires a running server, so we revert to simple grep |
| 133 |
# |
| 134 |
|
| 135 |
--error 0 |
| 136 |
--exec grep 'safe_to_bootstrap: 1' $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat |
| 137 |
|
| 138 |
--error 0 |
| 139 |
--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat |
| 140 |
|
| 141 |
--error 0 |
| 142 |
--exec grep 'safe_to_bootstrap: 0' $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat |
| 143 |
|
| 144 |
# |
| 145 |
# Attempt to bootstrap nodes #2, #3, should fail |
| 146 |
# |
| 147 |
|
| 148 |
--error 1 |
| 149 |
--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster --wsrep-cluster-address='gcomm://' | grep 'This node is not safe to bootstrap the cluster' |
| 150 |
--error 1 |
| 151 |
--exec $MYSQLD --defaults-group-suffix=.3 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-new-cluster --wsrep-cluster-address='gcomm://' | grep 'This node is not safe to bootstrap the cluster' |
| 152 |
|
| 153 |
# |
| 154 |
# Attempt to bootstrap starting from node #1, should succeed |
| 155 |
# |
| 156 |
|
| 157 |
--connection node_1 |
| 158 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 159 |
let $restart_noprint=2; |
| 160 |
--source include/start_mysqld.inc |
| 161 |
--source include/wait_until_connected_again.inc |
| 162 |
|
| 163 |
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 164 |
--source include/wait_condition.inc |
| 165 |
|
| 166 |
|
| 167 |
--connection node_2 |
| 168 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect |
| 169 |
let $restart_noprint=2; |
| 170 |
--source include/start_mysqld.inc |
| 171 |
|
| 172 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 173 |
--source include/wait_condition.inc |
| 174 |
|
| 175 |
|
| 176 |
--connection node_3 |
| 177 |
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.3.expect |
| 178 |
let $restart_noprint=2; |
| 179 |
--source include/start_mysqld.inc |
| 180 |
|
| 181 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 182 |
--source include/wait_condition.inc |
| 183 |
|
| 184 |
--connection node_2 |
| 185 |
CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); |
| 186 |
CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); |
| 187 |
CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); |
| 188 |
CALL mtr.add_suppression("Aborting"); |
| 189 |
CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); |
| 190 |
CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); |
| 191 |
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); |
| 192 |
CALL mtr.add_suppression("Aborting"); |
| 193 |
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); |
| 194 |
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); |
| 195 |
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); |
| 196 |
CALL mtr.add_suppression("Failed to initialize plugins\\."); |
| 197 |
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); |
| 198 |
|
| 199 |
--connection node_3 |
| 200 |
CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); |
| 201 |
CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); |
| 202 |
CALL mtr.add_suppression("WSREP: wsrep::connect(.*) failed: 7"); |
| 203 |
CALL mtr.add_suppression("Aborting"); |
| 204 |
CALL mtr.add_suppression("WSREP: moving position backwards: [0-9]+ -> 0"); |
| 205 |
CALL mtr.add_suppression("Failed to prepare for incremental state transfer"); |
| 206 |
CALL mtr.add_suppression("It may not be safe to bootstrap the cluster from this node"); |
| 207 |
CALL mtr.add_suppression("Aborting"); |
| 208 |
CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); |
| 209 |
CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); |
| 210 |
CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); |
| 211 |
CALL mtr.add_suppression("Failed to initialize plugins\\."); |
| 212 |
CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); |
| 213 |
|
| 214 |
SHOW CREATE TABLE t1; |
| 215 |
|
| 216 |
DROP TABLE t1; |
| 217 |
|
| 218 |
# |
| 219 |
# Restore auto increment variables. |
| 220 |
# |
| 221 |
--source ../galera/include/auto_increment_offset_restore.inc |