| 1 |
# |
| 2 |
# Tests handling of several configuration changes while a joiner gets |
| 3 |
# state transfer |
| 4 |
# |
| 5 |
# Variant B: sending of state transfer request is immediate but completion |
| 6 |
# of IST delayed until two more primary configuration changes happen |
| 7 |
# |
| 8 |
# Refs codersihp/galera-bugs#454 |
| 9 |
# |
| 10 |
--source include/have_innodb.inc |
| 11 |
--source include/galera_cluster.inc |
| 12 |
--source include/galera_have_debug_sync.inc |
| 13 |
|
| 14 |
--let $galera_connection_name = node_3 |
| 15 |
--let $galera_server_number = 3 |
| 16 |
--source include/galera_connect.inc |
| 17 |
|
| 18 |
# Save original auto_increment_offset values. |
| 19 |
--let $node_1=node_1 |
| 20 |
--let $node_2=node_2 |
| 21 |
--let $node_3=node_3 |
| 22 |
--source ../galera/include/auto_increment_offset_save.inc |
| 23 |
|
| 24 |
--connection node_1 |
| 25 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 26 |
--source include/wait_condition.inc |
| 27 |
|
| 28 |
CREATE TABLE t1 (pk INT PRIMARY KEY, node INT) ENGINE=innodb; |
| 29 |
INSERT INTO t1 VALUES (1, 1); |
| 30 |
|
| 31 |
--connection node_2 |
| 32 |
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; |
| 33 |
--source include/wait_condition.inc |
| 34 |
|
| 35 |
# |
| 36 |
# Isolate node_1 and update cluster state to force node 1 into joiner mode |
| 37 |
# |
| 38 |
--connection node_1 |
| 39 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; |
| 40 |
|
| 41 |
--connection node_2 |
| 42 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 43 |
--source include/wait_condition.inc |
| 44 |
|
| 45 |
--connection node_3 |
| 46 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 47 |
--source include/wait_condition.inc |
| 48 |
|
| 49 |
INSERT INTO t1 VALUES (2, 3); |
| 50 |
|
| 51 |
--connection node_2 |
| 52 |
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1; |
| 53 |
--source include/wait_condition.inc |
| 54 |
|
| 55 |
# |
| 56 |
# Now reconnect node_1 but first make it block before sending state transfer |
| 57 |
# request |
| 58 |
# |
| 59 |
# THIS IS PC1 |
| 60 |
# |
| 61 |
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 |
| 62 |
SET wsrep_sync_wait = 0; |
| 63 |
SET wsrep_on = OFF; |
| 64 |
--let $galera_sync_point = after_shift_to_joining |
| 65 |
--source include/galera_set_sync_point.inc |
| 66 |
|
| 67 |
--connection node_1 |
| 68 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; |
| 69 |
|
| 70 |
--connection node_2 |
| 71 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 72 |
--source include/wait_condition.inc |
| 73 |
|
| 74 |
INSERT INTO t1 VALUES (3, 2); |
| 75 |
|
| 76 |
--connection node_1a |
| 77 |
--source include/galera_wait_sync_point.inc |
| 78 |
# |
| 79 |
# At this point every node thinks that node_1 is in a JOINER state |
| 80 |
# |
| 81 |
|
| 82 |
--connection node_3 |
| 83 |
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; |
| 84 |
--source include/wait_condition.inc |
| 85 |
|
| 86 |
# |
| 87 |
# Now that node_1 sent state request and became JOINER isolate node_1 again |
| 88 |
# and commit one more action, so that node_1 loses JOINER state |
| 89 |
# |
| 90 |
--connection node_1 |
| 91 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; |
| 92 |
|
| 93 |
--connection node_2 |
| 94 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 95 |
--source include/wait_condition.inc |
| 96 |
|
| 97 |
--connection node_3 |
| 98 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 99 |
--source include/wait_condition.inc |
| 100 |
|
| 101 |
INSERT INTO t1 VALUES (4, 3); |
| 102 |
|
| 103 |
--connection node_2 |
| 104 |
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1; |
| 105 |
--source include/wait_condition.inc |
| 106 |
|
| 107 |
# |
| 108 |
# Reconnect node_1 again |
| 109 |
# |
| 110 |
# THIS IS PC2 |
| 111 |
# |
| 112 |
--connection node_1 |
| 113 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; |
| 114 |
|
| 115 |
--connection node_2 |
| 116 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 117 |
--source include/wait_condition.inc |
| 118 |
# |
| 119 |
# After this point node_1 is no longer JOINER and is required to start the |
| 120 |
# whole procedure over because it missed some actions (4th insert into t1) |
| 121 |
# |
| 122 |
|
| 123 |
INSERT INTO t1 VALUES (5, 2); |
| 124 |
|
| 125 |
--connection node_3 |
| 126 |
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; |
| 127 |
--source include/wait_condition.inc |
| 128 |
|
| 129 |
# |
| 130 |
# Now let node_1 continue with IST and finish processing PC1, but make it |
| 131 |
# block when processing PC2 right after progressing to JOINER state and |
| 132 |
# before IST happens. |
| 133 |
# |
| 134 |
--connection node_1a |
| 135 |
--let $galera_sync_point = before_send_state_request |
| 136 |
--source include/galera_set_sync_point.inc |
| 137 |
--let $galera_sync_point = after_shift_to_joining |
| 138 |
--source include/galera_signal_sync_point.inc |
| 139 |
--let $galera_sync_point = before_send_state_request |
| 140 |
--source include/galera_wait_sync_point.inc |
| 141 |
--source include/galera_clear_sync_point.inc |
| 142 |
# Here node_1 is processing PC2 just before sending state request |
| 143 |
|
| 144 |
# since PC1 has been processed node_1 must have 3 rows in t1 |
| 145 |
# 2 were there before PC1 and one was added while in PC1 |
| 146 |
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1; |
| 147 |
--source include/wait_condition.inc |
| 148 |
|
| 149 |
# Proceed to sending state transfer request and block right after |
| 150 |
--source include/galera_signal_sync_point.inc # before_send_state_request |
| 151 |
--let $galera_sync_point = after_shift_to_joining |
| 152 |
--source include/galera_wait_sync_point.inc |
| 153 |
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; |
| 154 |
|
| 155 |
# |
| 156 |
# Now disconnect and reconnect node_1 again to get PC3 |
| 157 |
# It is blocked right after shifting to JOINING state. |
| 158 |
# |
| 159 |
--connection node_1 |
| 160 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; |
| 161 |
|
| 162 |
--connection node_2 |
| 163 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 164 |
--source include/wait_condition.inc |
| 165 |
|
| 166 |
--connection node_3 |
| 167 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 168 |
--source include/wait_condition.inc |
| 169 |
|
| 170 |
INSERT INTO t1 VALUES (6, 3); |
| 171 |
|
| 172 |
--connection node_2 |
| 173 |
--let $wait_condition = SELECT COUNT(*) = 6 FROM t1; |
| 174 |
--source include/wait_condition.inc |
| 175 |
|
| 176 |
--connection node_1 |
| 177 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; |
| 178 |
|
| 179 |
--connection node_2 |
| 180 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 181 |
--source include/wait_condition.inc |
| 182 |
# |
| 183 |
# This is PC3 |
| 184 |
# |
| 185 |
|
| 186 |
INSERT INTO t1 VALUES (7, 2); |
| 187 |
|
| 188 |
--connection node_3 |
| 189 |
--let $wait_condition = SELECT COUNT(*) = 7 FROM t1; |
| 190 |
--source include/wait_condition.inc |
| 191 |
|
| 192 |
# |
| 193 |
# Now disconnect and reconnect node_1 again to get PC4 and allow node_1 |
| 194 |
# to continue with IST. |
| 195 |
# Note that node_1 still processes PC2 and is joining. |
| 196 |
# |
| 197 |
--connection node_1 |
| 198 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; |
| 199 |
|
| 200 |
--connection node_2 |
| 201 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 202 |
--source include/wait_condition.inc |
| 203 |
|
| 204 |
--connection node_3 |
| 205 |
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 206 |
--source include/wait_condition.inc |
| 207 |
|
| 208 |
INSERT INTO t1 VALUES (8, 3); |
| 209 |
|
| 210 |
--connection node_2 |
| 211 |
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; |
| 212 |
--source include/wait_condition.inc |
| 213 |
|
| 214 |
--connection node_1 |
| 215 |
SET GLOBAL wsrep_provider_options='gmcast.isolate=0'; |
| 216 |
|
| 217 |
--connection node_2 |
| 218 |
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; |
| 219 |
--source include/wait_condition.inc |
| 220 |
# |
| 221 |
# This is PC4. node_1 is still processing PC2, waiting to send state trasfer |
| 222 |
# request |
| 223 |
# |
| 224 |
--connection node_1a |
| 225 |
--let $galera_sync_point = process_primary_configuration |
| 226 |
--source include/galera_set_sync_point.inc |
| 227 |
--let $galera_sync_point = after_shift_to_joining |
| 228 |
--source include/galera_signal_sync_point.inc |
| 229 |
# continue with IST prepared for in PC2 |
| 230 |
|
| 231 |
--let $galera_sync_point = process_primary_configuration |
| 232 |
--source include/galera_wait_sync_point.inc |
| 233 |
# |
| 234 |
# Now node_1 is processing PC3, and should have finished state transfer |
| 235 |
# State tranfer request was dilivered before PC3, so node_1 should have |
| 236 |
# received IST up to 4 rows in t1 (what was there before PC2) plus one more |
| 237 |
# INSERT while in PC2. |
| 238 |
# |
| 239 |
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; |
| 240 |
--source include/wait_condition.inc |
| 241 |
|
| 242 |
--connection node_2 |
| 243 |
INSERT INTO t1 VALUES (9, 2); |
| 244 |
|
| 245 |
--connection node_3 |
| 246 |
--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; |
| 247 |
--source include/wait_condition.inc |
| 248 |
|
| 249 |
--connection node_1a |
| 250 |
#--let $galera_sync_point = process_primary_configuration |
| 251 |
--source include/galera_signal_sync_point.inc |
| 252 |
--source include/galera_wait_sync_point.inc |
| 253 |
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters'; |
| 254 |
# |
| 255 |
# Now node_1 is processing PC4, still must have 8 rows in t1 |
| 256 |
# |
| 257 |
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1; |
| 258 |
--source include/wait_condition.inc |
| 259 |
|
| 260 |
#--let $galera_sync_point = process_primary_configuration |
| 261 |
--source include/galera_signal_sync_point.inc |
| 262 |
--source include/galera_clear_sync_point.inc |
| 263 |
|
| 264 |
--let $wait_condition = SELECT COUNT(*) = 9 FROM t1; |
| 265 |
--source include/wait_condition.inc |
| 266 |
|
| 267 |
--connection node_1 |
| 268 |
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; |
| 269 |
--source include/wait_condition.inc |
| 270 |
|
| 271 |
DROP TABLE t1; |
| 272 |
|
| 273 |
call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); |
| 274 |
|
| 275 |
--connection node_2 |
| 276 |
call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); |
| 277 |
|
| 278 |
--connection node_3 |
| 279 |
call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); |
| 280 |
|
| 281 |
--disconnect node_1a |
| 282 |
|
| 283 |
# Restore original auto_increment_offset values. |
| 284 |
--let $galera_cluster_size=3 |
| 285 |
--source ../galera/include/auto_increment_offset_restore.inc |
| 286 |
--source include/galera_end.inc |