| 1 |
############################# |
| 2 |
# Common setup for all tests |
| 3 |
############################# |
| 4 |
# Note: Simulated slave delay is hardcoded to 800 milliseconds |
| 5 |
# Note: Simulated master shutdown delay is hardcoded to 500 milliseconds |
| 6 |
include/rpl_init.inc [topology=1->2, 1->3] |
| 7 |
connection server_1; |
| 8 |
# Slaves which simulate an error will produce a timeout on the primary |
| 9 |
call mtr.add_suppression("Timeout waiting"); |
| 10 |
call mtr.add_suppression("did not exit"); |
| 11 |
call mtr.add_suppression("Got an error reading communication packets"); |
| 12 |
# Suppress slave errors related to the simulated error |
| 13 |
connection server_2; |
| 14 |
call mtr.add_suppression("reply failed"); |
| 15 |
call mtr.add_suppression("Replication event checksum verification"); |
| 16 |
call mtr.add_suppression("Relay log write failure"); |
| 17 |
call mtr.add_suppression("Failed to kill the active semi-sync connection"); |
| 18 |
set @sav_enabled_server_2= @@GLOBAL.rpl_semi_sync_slave_enabled; |
| 19 |
set @sav_server_2_dbug= @@GLOBAL.debug_dbug; |
| 20 |
connection server_3; |
| 21 |
call mtr.add_suppression("reply failed"); |
| 22 |
call mtr.add_suppression("Replication event checksum verification"); |
| 23 |
call mtr.add_suppression("Relay log write failure"); |
| 24 |
call mtr.add_suppression("Failed to kill the active semi-sync connection"); |
| 25 |
set @sav_enabled_server_3= @@GLOBAL.rpl_semi_sync_slave_enabled; |
| 26 |
set @sav_server_3_dbug= @@GLOBAL.debug_dbug; |
| 27 |
connection server_1; |
| 28 |
CREATE TABLE t1 (a int) engine=innodb; |
| 29 |
connection server_2; |
| 30 |
connection server_3; |
| 31 |
connect server_1_con2, localhost, root,,; |
| 32 |
############################# |
| 33 |
# Test cases |
| 34 |
############################# |
| 35 |
# |
| 36 |
# Test Case 1) If both replicas simulate a delay that is within the |
| 37 |
# allowed timeout, the primary should delay killing the Ack_thread |
| 38 |
# until an ACK is received. |
| 39 |
# |
| 40 |
connection server_1; |
| 41 |
#-- |
| 42 |
#-- Semi-sync Setup |
| 43 |
connection server_1; |
| 44 |
#-- Enable semi-sync on slaves |
| 45 |
let slave_last= 3 |
| 46 |
connection server_2; |
| 47 |
include/stop_slave.inc |
| 48 |
set global rpl_semi_sync_slave_enabled = 1; |
| 49 |
include/start_slave.inc |
| 50 |
show status like 'Rpl_semi_sync_slave_status'; |
| 51 |
Variable_name Value |
| 52 |
Rpl_semi_sync_slave_status ON |
| 53 |
connection server_3; |
| 54 |
include/stop_slave.inc |
| 55 |
set global rpl_semi_sync_slave_enabled = 1; |
| 56 |
include/start_slave.inc |
| 57 |
show status like 'Rpl_semi_sync_slave_status'; |
| 58 |
Variable_name Value |
| 59 |
Rpl_semi_sync_slave_status ON |
| 60 |
#-- Enable semi-sync on master |
| 61 |
connection server_1; |
| 62 |
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; |
| 63 |
set @@global.rpl_semi_sync_master_timeout= 1600; |
| 64 |
#-- Wait for master to recognize semi-sync slaves |
| 65 |
connection server_1; |
| 66 |
#-- Master should have semi-sync enabled with 2 connections |
| 67 |
show status like 'Rpl_semi_sync_master_status'; |
| 68 |
Variable_name Value |
| 69 |
Rpl_semi_sync_master_status ON |
| 70 |
show status like 'Rpl_semi_sync_master_clients'; |
| 71 |
Variable_name Value |
| 72 |
Rpl_semi_sync_master_clients 2 |
| 73 |
#-- Prepare servers to simulate delay or error |
| 74 |
connection server_2; |
| 75 |
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; |
| 76 |
connection server_3; |
| 77 |
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; |
| 78 |
#-- |
| 79 |
#-- Test begins |
| 80 |
connection server_1_con2; |
| 81 |
connection server_1; |
| 82 |
#-- Begin semi-sync transaction |
| 83 |
INSERT INTO t1 VALUES (1); |
| 84 |
connection server_1_con2; |
| 85 |
#-- Wait until master recognizes a connection is awaiting semi-sync ACK |
| 86 |
connection server_2; |
| 87 |
set debug_sync= "now wait_for io_thd_at_slave_reply"; |
| 88 |
connection server_3; |
| 89 |
set debug_sync= "now wait_for io_thd_at_slave_reply"; |
| 90 |
connection server_1_con2; |
| 91 |
#-- Begin master shutdown |
| 92 |
SHUTDOWN WAIT FOR ALL SLAVES; |
| 93 |
connection server_2; |
| 94 |
# Waitng for shutdown to be delayed.. |
| 95 |
FOUND 1 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err |
| 96 |
connection server_2; |
| 97 |
set debug_sync= "now signal io_thd_do_reply"; |
| 98 |
connection server_3; |
| 99 |
set debug_sync= "now signal io_thd_do_reply"; |
| 100 |
# Reaping transaction.. |
| 101 |
connection server_1; |
| 102 |
ERROR HY000: Lost connection to server during query |
| 103 |
connection server_2; |
| 104 |
# Reaping shutdown.. |
| 105 |
connection server_1_con2; |
| 106 |
# Validate slave data is in correct state |
| 107 |
connection server_2; |
| 108 |
select count(*)=1 from t1; |
| 109 |
count(*)=1 |
| 110 |
1 |
| 111 |
connection server_3; |
| 112 |
select count(*)=1 from t1; |
| 113 |
count(*)=1 |
| 114 |
1 |
| 115 |
# |
| 116 |
#-- Re-synchronize slaves with master and disable semi-sync |
| 117 |
#-- Stop slaves |
| 118 |
connection server_2; |
| 119 |
include/stop_slave_io.inc |
| 120 |
include/stop_slave_sql.inc |
| 121 |
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug; |
| 122 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2; |
| 123 |
connection server_3; |
| 124 |
include/stop_slave_io.inc |
| 125 |
include/stop_slave_sql.inc |
| 126 |
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug; |
| 127 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3; |
| 128 |
#-- Bring the master back up |
| 129 |
connection server_1_con2; |
| 130 |
connection default; |
| 131 |
connection server_1; |
| 132 |
TRUNCATE TABLE t1; |
| 133 |
#-- Bring slaves back up |
| 134 |
connection server_2; |
| 135 |
include/start_slave.inc |
| 136 |
show status like 'Rpl_semi_sync_slave_status'; |
| 137 |
Variable_name Value |
| 138 |
Rpl_semi_sync_slave_status OFF |
| 139 |
SELECT COUNT(*)=0 from t1; |
| 140 |
COUNT(*)=0 |
| 141 |
1 |
| 142 |
connection server_3; |
| 143 |
include/start_slave.inc |
| 144 |
show status like 'Rpl_semi_sync_slave_status'; |
| 145 |
Variable_name Value |
| 146 |
Rpl_semi_sync_slave_status OFF |
| 147 |
SELECT COUNT(*)=0 from t1; |
| 148 |
COUNT(*)=0 |
| 149 |
1 |
| 150 |
# |
| 151 |
# Test Case 2) If both replicas simulate an error before sending an ACK, |
| 152 |
# the primary should delay killing the Ack_thread until the |
| 153 |
# timeout is reached. |
| 154 |
# |
| 155 |
connection server_1; |
| 156 |
#-- |
| 157 |
#-- Semi-sync Setup |
| 158 |
connection server_1; |
| 159 |
#-- Enable semi-sync on slaves |
| 160 |
let slave_last= 3 |
| 161 |
connection server_2; |
| 162 |
include/stop_slave.inc |
| 163 |
set global rpl_semi_sync_slave_enabled = 1; |
| 164 |
include/start_slave.inc |
| 165 |
show status like 'Rpl_semi_sync_slave_status'; |
| 166 |
Variable_name Value |
| 167 |
Rpl_semi_sync_slave_status ON |
| 168 |
connection server_3; |
| 169 |
include/stop_slave.inc |
| 170 |
set global rpl_semi_sync_slave_enabled = 1; |
| 171 |
include/start_slave.inc |
| 172 |
show status like 'Rpl_semi_sync_slave_status'; |
| 173 |
Variable_name Value |
| 174 |
Rpl_semi_sync_slave_status ON |
| 175 |
#-- Enable semi-sync on master |
| 176 |
connection server_1; |
| 177 |
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; |
| 178 |
set @@global.rpl_semi_sync_master_timeout= 500; |
| 179 |
#-- Wait for master to recognize semi-sync slaves |
| 180 |
connection server_1; |
| 181 |
#-- Master should have semi-sync enabled with 2 connections |
| 182 |
show status like 'Rpl_semi_sync_master_status'; |
| 183 |
Variable_name Value |
| 184 |
Rpl_semi_sync_master_status ON |
| 185 |
show status like 'Rpl_semi_sync_master_clients'; |
| 186 |
Variable_name Value |
| 187 |
Rpl_semi_sync_master_clients 2 |
| 188 |
#-- Prepare servers to simulate delay or error |
| 189 |
connection server_2; |
| 190 |
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"; |
| 191 |
connection server_3; |
| 192 |
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"; |
| 193 |
#-- |
| 194 |
#-- Test begins |
| 195 |
connection server_1_con2; |
| 196 |
connection server_1; |
| 197 |
#-- Begin semi-sync transaction |
| 198 |
INSERT INTO t1 VALUES (1); |
| 199 |
connection server_1_con2; |
| 200 |
#-- Wait until master recognizes a connection is awaiting semi-sync ACK |
| 201 |
connection server_1_con2; |
| 202 |
#-- Begin master shutdown |
| 203 |
SHUTDOWN WAIT FOR ALL SLAVES; |
| 204 |
connection server_2; |
| 205 |
# Waitng for shutdown to be delayed.. |
| 206 |
FOUND 2 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err |
| 207 |
# Reaping transaction.. |
| 208 |
connection server_1; |
| 209 |
ERROR HY000: Lost connection to server during query |
| 210 |
connection server_2; |
| 211 |
# Reaping shutdown.. |
| 212 |
connection server_1_con2; |
| 213 |
# Validate slave data is in correct state |
| 214 |
connection server_2; |
| 215 |
select count(*)=0 from t1; |
| 216 |
count(*)=0 |
| 217 |
1 |
| 218 |
connection server_3; |
| 219 |
select count(*)=0 from t1; |
| 220 |
count(*)=0 |
| 221 |
1 |
| 222 |
# |
| 223 |
#-- Re-synchronize slaves with master and disable semi-sync |
| 224 |
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from |
| 225 |
# killing their semi-sync connections |
| 226 |
connection server_2; |
| 227 |
set debug_sync= "now wait_for at_semisync_kill_connection"; |
| 228 |
set debug_sync= "now signal continue_semisync_kill_connection"; |
| 229 |
# Wait for debug_sync signal to have been received before issuing RESET |
| 230 |
set debug_sync= "reset"; |
| 231 |
connection server_3; |
| 232 |
set debug_sync= "now wait_for at_semisync_kill_connection"; |
| 233 |
set debug_sync= "now signal continue_semisync_kill_connection"; |
| 234 |
# Wait for debug_sync signal to have been received before issuing RESET |
| 235 |
set debug_sync= "reset"; |
| 236 |
#-- Stop slaves |
| 237 |
connection server_2; |
| 238 |
include/stop_slave_io.inc |
| 239 |
include/stop_slave_sql.inc |
| 240 |
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug; |
| 241 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2; |
| 242 |
connection server_3; |
| 243 |
include/stop_slave_io.inc |
| 244 |
include/stop_slave_sql.inc |
| 245 |
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug; |
| 246 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3; |
| 247 |
#-- Bring the master back up |
| 248 |
connection server_1_con2; |
| 249 |
connection default; |
| 250 |
connection server_1; |
| 251 |
TRUNCATE TABLE t1; |
| 252 |
#-- Bring slaves back up |
| 253 |
connection server_2; |
| 254 |
include/start_slave.inc |
| 255 |
show status like 'Rpl_semi_sync_slave_status'; |
| 256 |
Variable_name Value |
| 257 |
Rpl_semi_sync_slave_status OFF |
| 258 |
SELECT COUNT(*)=0 from t1; |
| 259 |
COUNT(*)=0 |
| 260 |
1 |
| 261 |
connection server_3; |
| 262 |
include/start_slave.inc |
| 263 |
show status like 'Rpl_semi_sync_slave_status'; |
| 264 |
Variable_name Value |
| 265 |
Rpl_semi_sync_slave_status OFF |
| 266 |
SELECT COUNT(*)=0 from t1; |
| 267 |
COUNT(*)=0 |
| 268 |
1 |
| 269 |
# |
| 270 |
# Test Case 3) If one replica simulates a delay within the allowed |
| 271 |
# timeout and the other simulates an error before sending an ACK, the |
| 272 |
# primary should delay killing the Ack_thread until it receives an |
| 273 |
# ACK from the delayed slave. |
| 274 |
# |
| 275 |
connection server_1; |
| 276 |
#-- |
| 277 |
#-- Semi-sync Setup |
| 278 |
connection server_1; |
| 279 |
#-- Enable semi-sync on slaves |
| 280 |
let slave_last= 3 |
| 281 |
connection server_2; |
| 282 |
include/stop_slave.inc |
| 283 |
set global rpl_semi_sync_slave_enabled = 1; |
| 284 |
include/start_slave.inc |
| 285 |
show status like 'Rpl_semi_sync_slave_status'; |
| 286 |
Variable_name Value |
| 287 |
Rpl_semi_sync_slave_status ON |
| 288 |
connection server_3; |
| 289 |
include/stop_slave.inc |
| 290 |
set global rpl_semi_sync_slave_enabled = 1; |
| 291 |
include/start_slave.inc |
| 292 |
show status like 'Rpl_semi_sync_slave_status'; |
| 293 |
Variable_name Value |
| 294 |
Rpl_semi_sync_slave_status ON |
| 295 |
#-- Enable semi-sync on master |
| 296 |
connection server_1; |
| 297 |
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; |
| 298 |
set @@global.rpl_semi_sync_master_timeout= 1600; |
| 299 |
#-- Wait for master to recognize semi-sync slaves |
| 300 |
connection server_1; |
| 301 |
#-- Master should have semi-sync enabled with 2 connections |
| 302 |
show status like 'Rpl_semi_sync_master_status'; |
| 303 |
Variable_name Value |
| 304 |
Rpl_semi_sync_master_status ON |
| 305 |
show status like 'Rpl_semi_sync_master_clients'; |
| 306 |
Variable_name Value |
| 307 |
Rpl_semi_sync_master_clients 2 |
| 308 |
#-- Prepare servers to simulate delay or error |
| 309 |
connection server_2; |
| 310 |
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"; |
| 311 |
connection server_3; |
| 312 |
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; |
| 313 |
#-- |
| 314 |
#-- Test begins |
| 315 |
connection server_1_con2; |
| 316 |
connection server_1; |
| 317 |
#-- Begin semi-sync transaction |
| 318 |
INSERT INTO t1 VALUES (1); |
| 319 |
connection server_1_con2; |
| 320 |
#-- Wait until master recognizes a connection is awaiting semi-sync ACK |
| 321 |
connection server_3; |
| 322 |
set debug_sync= "now wait_for io_thd_at_slave_reply"; |
| 323 |
connection server_1_con2; |
| 324 |
#-- Begin master shutdown |
| 325 |
SHUTDOWN WAIT FOR ALL SLAVES; |
| 326 |
connection server_2; |
| 327 |
# Waitng for shutdown to be delayed.. |
| 328 |
FOUND 3 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err |
| 329 |
connection server_3; |
| 330 |
set debug_sync= "now signal io_thd_do_reply"; |
| 331 |
# Reaping transaction.. |
| 332 |
connection server_1; |
| 333 |
ERROR HY000: Lost connection to server during query |
| 334 |
connection server_2; |
| 335 |
# Reaping shutdown.. |
| 336 |
connection server_1_con2; |
| 337 |
# Validate slave data is in correct state |
| 338 |
connection server_2; |
| 339 |
select count(*)=0 from t1; |
| 340 |
count(*)=0 |
| 341 |
1 |
| 342 |
connection server_3; |
| 343 |
select count(*)=1 from t1; |
| 344 |
count(*)=1 |
| 345 |
1 |
| 346 |
# |
| 347 |
#-- Re-synchronize slaves with master and disable semi-sync |
| 348 |
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from |
| 349 |
# killing their semi-sync connections |
| 350 |
connection server_2; |
| 351 |
set debug_sync= "now wait_for at_semisync_kill_connection"; |
| 352 |
set debug_sync= "now signal continue_semisync_kill_connection"; |
| 353 |
# Wait for debug_sync signal to have been received before issuing RESET |
| 354 |
set debug_sync= "reset"; |
| 355 |
#-- Stop slaves |
| 356 |
connection server_2; |
| 357 |
include/stop_slave_io.inc |
| 358 |
include/stop_slave_sql.inc |
| 359 |
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug; |
| 360 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2; |
| 361 |
connection server_3; |
| 362 |
include/stop_slave_io.inc |
| 363 |
include/stop_slave_sql.inc |
| 364 |
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug; |
| 365 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3; |
| 366 |
#-- Bring the master back up |
| 367 |
connection server_1_con2; |
| 368 |
connection default; |
| 369 |
connection server_1; |
| 370 |
TRUNCATE TABLE t1; |
| 371 |
#-- Bring slaves back up |
| 372 |
connection server_2; |
| 373 |
include/start_slave.inc |
| 374 |
show status like 'Rpl_semi_sync_slave_status'; |
| 375 |
Variable_name Value |
| 376 |
Rpl_semi_sync_slave_status OFF |
| 377 |
SELECT COUNT(*)=0 from t1; |
| 378 |
COUNT(*)=0 |
| 379 |
1 |
| 380 |
connection server_3; |
| 381 |
include/start_slave.inc |
| 382 |
show status like 'Rpl_semi_sync_slave_status'; |
| 383 |
Variable_name Value |
| 384 |
Rpl_semi_sync_slave_status OFF |
| 385 |
SELECT COUNT(*)=0 from t1; |
| 386 |
COUNT(*)=0 |
| 387 |
1 |
| 388 |
# |
| 389 |
# Test Case 4) If a replica errors before sending an ACK, it will cause |
| 390 |
# the IO thread to stop and handle the error. During error handling, if |
| 391 |
# semi-sync is active, the replica will form a new connection with the |
| 392 |
# primary to kill the active connection. However, if the primary is |
| 393 |
# shutting down, it may kill the new connection, thereby leaving the |
| 394 |
# active semi-sync connection in-tact. The slave should notice this, and |
| 395 |
# not issue a `QUIT` command to the primary, which would otherwise be |
| 396 |
# sent to kill an active connection. This test case validates that the |
| 397 |
# slave does not send a `QUIT` in this case. |
| 398 |
# |
| 399 |
connection server_1; |
| 400 |
#-- |
| 401 |
#-- Semi-sync Setup |
| 402 |
connection server_1; |
| 403 |
#-- Enable semi-sync on slaves |
| 404 |
let slave_last= 3 |
| 405 |
connection server_2; |
| 406 |
include/stop_slave.inc |
| 407 |
set global rpl_semi_sync_slave_enabled = 1; |
| 408 |
include/start_slave.inc |
| 409 |
show status like 'Rpl_semi_sync_slave_status'; |
| 410 |
Variable_name Value |
| 411 |
Rpl_semi_sync_slave_status ON |
| 412 |
connection server_3; |
| 413 |
include/stop_slave.inc |
| 414 |
set global rpl_semi_sync_slave_enabled = 1; |
| 415 |
include/start_slave.inc |
| 416 |
show status like 'Rpl_semi_sync_slave_status'; |
| 417 |
Variable_name Value |
| 418 |
Rpl_semi_sync_slave_status ON |
| 419 |
#-- Enable semi-sync on master |
| 420 |
connection server_1; |
| 421 |
SET @@GLOBAL.rpl_semi_sync_master_enabled = 1; |
| 422 |
set @@global.rpl_semi_sync_master_timeout= 1600; |
| 423 |
#-- Wait for master to recognize semi-sync slaves |
| 424 |
connection server_1; |
| 425 |
#-- Master should have semi-sync enabled with 2 connections |
| 426 |
show status like 'Rpl_semi_sync_master_status'; |
| 427 |
Variable_name Value |
| 428 |
Rpl_semi_sync_master_status ON |
| 429 |
show status like 'Rpl_semi_sync_master_clients'; |
| 430 |
Variable_name Value |
| 431 |
Rpl_semi_sync_master_clients 2 |
| 432 |
#-- Prepare servers to simulate delay or error |
| 433 |
connection server_2; |
| 434 |
SET @@GLOBAL.debug_dbug= "+d,corrupt_queue_event,delay_semisync_kill_connection_for_mdev_28141"; |
| 435 |
connection server_3; |
| 436 |
SET @@GLOBAL.debug_dbug= "+d,simulate_delay_semisync_slave_reply"; |
| 437 |
#-- |
| 438 |
#-- Test begins |
| 439 |
connection server_1_con2; |
| 440 |
connection server_1; |
| 441 |
#-- Begin semi-sync transaction |
| 442 |
INSERT INTO t1 VALUES (1); |
| 443 |
connection server_1_con2; |
| 444 |
#-- Wait until master recognizes a connection is awaiting semi-sync ACK |
| 445 |
connection server_3; |
| 446 |
set debug_sync= "now wait_for io_thd_at_slave_reply"; |
| 447 |
connection server_1_con2; |
| 448 |
#-- Begin master shutdown |
| 449 |
SHUTDOWN WAIT FOR ALL SLAVES; |
| 450 |
connection server_2; |
| 451 |
# Waitng for shutdown to be delayed.. |
| 452 |
FOUND 4 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err |
| 453 |
connection server_3; |
| 454 |
set debug_sync= "now signal io_thd_do_reply"; |
| 455 |
# Reaping transaction.. |
| 456 |
connection server_1; |
| 457 |
ERROR HY000: Lost connection to server during query |
| 458 |
connection server_2; |
| 459 |
# Reaping shutdown.. |
| 460 |
connection server_1_con2; |
| 461 |
# Validate slave data is in correct state |
| 462 |
connection server_2; |
| 463 |
select count(*)=0 from t1; |
| 464 |
count(*)=0 |
| 465 |
1 |
| 466 |
connection server_3; |
| 467 |
select count(*)=1 from t1; |
| 468 |
count(*)=1 |
| 469 |
1 |
| 470 |
# |
| 471 |
#-- Re-synchronize slaves with master and disable semi-sync |
| 472 |
#-- FIXME: workaround for MDEV-28141, preventing errored replicas from |
| 473 |
# killing their semi-sync connections |
| 474 |
connection server_2; |
| 475 |
set debug_sync= "now wait_for at_semisync_kill_connection"; |
| 476 |
set debug_sync= "now signal continue_semisync_kill_connection"; |
| 477 |
# Wait for debug_sync signal to have been received before issuing RESET |
| 478 |
set debug_sync= "reset"; |
| 479 |
#-- Stop slaves |
| 480 |
connection server_2; |
| 481 |
include/stop_slave_io.inc |
| 482 |
include/stop_slave_sql.inc |
| 483 |
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug; |
| 484 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_2; |
| 485 |
connection server_3; |
| 486 |
include/stop_slave_io.inc |
| 487 |
include/stop_slave_sql.inc |
| 488 |
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug; |
| 489 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @sav_enabled_server_3; |
| 490 |
#-- Bring the master back up |
| 491 |
connection server_1_con2; |
| 492 |
connection default; |
| 493 |
connection server_1; |
| 494 |
TRUNCATE TABLE t1; |
| 495 |
#-- Bring slaves back up |
| 496 |
connection server_2; |
| 497 |
include/start_slave.inc |
| 498 |
show status like 'Rpl_semi_sync_slave_status'; |
| 499 |
Variable_name Value |
| 500 |
Rpl_semi_sync_slave_status OFF |
| 501 |
SELECT COUNT(*)=0 from t1; |
| 502 |
COUNT(*)=0 |
| 503 |
1 |
| 504 |
connection server_3; |
| 505 |
include/start_slave.inc |
| 506 |
show status like 'Rpl_semi_sync_slave_status'; |
| 507 |
Variable_name Value |
| 508 |
Rpl_semi_sync_slave_status OFF |
| 509 |
SELECT COUNT(*)=0 from t1; |
| 510 |
COUNT(*)=0 |
| 511 |
1 |
| 512 |
# |
| 513 |
# Test Case 5) If a waiting-for-ACK user thread is killed (disconnected) |
| 514 |
# during SHUTDOWN WAIT FOR ALL SLAVES, ensure the primary will still |
| 515 |
# await the ACK from the replica before killing the Ack_receiver thread |
| 516 |
# |
| 517 |
connection server_1; |
| 518 |
insert into t1 values (1); |
| 519 |
include/save_master_gtid.inc |
| 520 |
connection server_2; |
| 521 |
include/sync_with_master_gtid.inc |
| 522 |
include/stop_slave.inc |
| 523 |
SET GLOBAL rpl_semi_sync_slave_enabled= 1; |
| 524 |
include/start_slave.inc |
| 525 |
connection server_1; |
| 526 |
SET GLOBAL rpl_semi_sync_master_enabled= 1; |
| 527 |
SET GLOBAL rpl_semi_sync_master_timeout= 2000; |
| 528 |
show status like 'Rpl_semi_sync_master_status'; |
| 529 |
Variable_name Value |
| 530 |
Rpl_semi_sync_master_status ON |
| 531 |
show status like 'Rpl_semi_sync_master_clients'; |
| 532 |
Variable_name Value |
| 533 |
Rpl_semi_sync_master_clients 1 |
| 534 |
connection server_2; |
| 535 |
SET @old_dbug= @@GLOBAL.debug_dbug; |
| 536 |
SET GLOBAL debug_dbug="+d,simulate_delay_semisync_slave_reply"; |
| 537 |
connect con1, localhost, root,,; |
| 538 |
connect con2, localhost, root,,; |
| 539 |
connection con1; |
| 540 |
insert into t1 values (2); |
| 541 |
connection server_1; |
| 542 |
# Wait for thd to begin semi-sync wait.. |
| 543 |
# ..done |
| 544 |
connection server_2; |
| 545 |
set debug_sync= "now wait_for io_thd_at_slave_reply"; |
| 546 |
disconnect con1; |
| 547 |
connection default; |
| 548 |
connection con2; |
| 549 |
SHUTDOWN WAIT FOR ALL SLAVES; |
| 550 |
# Waitng for shutdown to be delayed.. |
| 551 |
connection server_2; |
| 552 |
FOUND 5 /Delaying shutdown to await semi-sync ACK/ in mysqld.1.err |
| 553 |
connection default; |
| 554 |
connection server_1; |
| 555 |
connection con2; |
| 556 |
connection server_2; |
| 557 |
set debug_sync= "now signal io_thd_do_reply"; |
| 558 |
include/stop_slave.inc |
| 559 |
connection server_3; |
| 560 |
include/stop_slave.inc |
| 561 |
connection default; |
| 562 |
connection server_1; |
| 563 |
############################# |
| 564 |
# Cleanup |
| 565 |
############################# |
| 566 |
connection server_2; |
| 567 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_2; |
| 568 |
SET @@GLOBAL.debug_dbug= @sav_server_2_dbug; |
| 569 |
include/start_slave.inc |
| 570 |
connection server_3; |
| 571 |
SET @@GLOBAL.rpl_semi_sync_slave_enabled = @sav_enabled_server_3; |
| 572 |
SET @@GLOBAL.debug_dbug= @sav_server_3_dbug; |
| 573 |
include/start_slave.inc |
| 574 |
connection server_1; |
| 575 |
drop table t1; |
| 576 |
include/rpl_end.inc |