| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
# |
| 4 |
# MDEV-29639: Seconds_Behind_Master is incorrect for Delayed, Parallel Replicas |
| 5 |
# |
| 6 |
connection slave; |
| 7 |
include/stop_slave.inc |
| 8 |
set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; |
| 9 |
set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; |
| 10 |
change master to master_delay=1, master_use_gtid=Slave_Pos; |
| 11 |
include/start_slave.inc |
| 12 |
connection master; |
| 13 |
create table t1 (a int); |
| 14 |
create table t2 (a int); |
| 15 |
include/save_master_gtid.inc |
| 16 |
connection slave; |
| 17 |
include/sync_with_master_sql_delay_debug_sync.inc |
| 18 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 19 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 20 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 21 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 22 |
# |
| 23 |
# Pt 1) Ensure SBM is updated immediately upon arrival of the next event |
| 24 |
connection master; |
| 25 |
# Sleep 2 to allow a buffer between events for SBM check |
| 26 |
insert into t1 values (0); |
| 27 |
include/save_master_gtid.inc |
| 28 |
connection slave; |
| 29 |
# Waiting for transaction to arrive on slave and begin SQL Delay.. |
| 30 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 31 |
# Validating SBM is updated on event arrival.. |
| 32 |
# ..done |
| 33 |
# MDEV-33856: New definition for Seconds_Behind_Master |
| 34 |
# Validating Master_last_event_time is updated on event arrival.. |
| 35 |
# ..done |
| 36 |
# Validating Slave_last_event_time is still from the last transaction.. |
| 37 |
# ..done |
| 38 |
# MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently |
| 39 |
# delaying a transaction; then when the reciprocal START SLAVE occurs, |
| 40 |
# if the event is still to be delayed, SBM should resume accordingly |
| 41 |
connection server_2; |
| 42 |
# Ensure the kill from STOP SLAVE will be received before continuing the |
| 43 |
# SQL thread |
| 44 |
set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; |
| 45 |
STOP SLAVE; |
| 46 |
connection slave; |
| 47 |
set debug_sync= "now WAIT_FOR slave_notified_of_kill"; |
| 48 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 49 |
connection server_2; |
| 50 |
include/wait_for_slave_to_stop.inc |
| 51 |
set debug_sync="RESET"; |
| 52 |
# Lock t1 on slave to ensure the event can't finish (and thereby update |
| 53 |
# Seconds_Behind_Master) so slow running servers don't accidentally |
| 54 |
# catch up to the master before checking SBM. |
| 55 |
connection server_2; |
| 56 |
LOCK TABLES t1 WRITE; |
| 57 |
include/start_slave.inc |
| 58 |
connection slave; |
| 59 |
# SQL delay has no impact for the rest of the test case, so ignore it |
| 60 |
include/sync_with_master_sql_delay_debug_sync.inc |
| 61 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 62 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 63 |
# Waiting for replica to get blocked by the table lock |
| 64 |
# Sleeping 1s to increment SBM |
| 65 |
# Ensuring Seconds_Behind_Master increases after sleeping.. |
| 66 |
# ..done |
| 67 |
connection server_2; |
| 68 |
UNLOCK TABLES; |
| 69 |
include/sync_with_master_gtid.inc |
| 70 |
# MDEV-33856: New definition for Seconds_Behind_Master |
| 71 |
# Waiting for slave timing statistics to update .. |
| 72 |
# Ensuring Slave_last_event_time is now up-to-date once event is executed |
| 73 |
# ..done |
| 74 |
# |
| 75 |
# Pt 2) If the worker threads have not entered an idle state, ensure |
| 76 |
# following events do not update SBM |
| 77 |
connection slave; |
| 78 |
LOCK TABLES t1 WRITE; |
| 79 |
connection master; |
| 80 |
# Sleep 2 to allow a buffer between events for SBM check |
| 81 |
insert into t1 values (1); |
| 82 |
# Sleep 3 to create gap between events |
| 83 |
insert into t1 values (2); |
| 84 |
include/save_master_pos.inc |
| 85 |
connection slave; |
| 86 |
# Wait for first transaction to complete SQL delay and begin execution.. |
| 87 |
include/sync_with_master_sql_delay_debug_sync.inc |
| 88 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 89 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 90 |
# Wait for second transaction to complete SQL delay.. |
| 91 |
include/sync_with_master_sql_delay_debug_sync.inc |
| 92 |
set debug_sync= "now WAIT_FOR at_sql_delay"; |
| 93 |
set debug_sync= "now SIGNAL continue_sql_thread"; |
| 94 |
# Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. |
| 95 |
# ..and that SBM wasn't calculated using prior committed transactions |
| 96 |
# ..done |
| 97 |
connection slave; |
| 98 |
UNLOCK TABLES; |
| 99 |
include/wait_for_slave_param.inc [Relay_Master_Log_File] |
| 100 |
include/wait_for_slave_param.inc [Exec_Master_Log_Pos] |
| 101 |
# Cleanup |
| 102 |
include/stop_slave.inc |
| 103 |
set debug_sync= "RESET"; |
| 104 |
set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; |
| 105 |
CHANGE MASTER TO master_delay=0; |
| 106 |
include/start_slave.inc |
| 107 |
# |
| 108 |
# MDEV-30619: Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers |
| 109 |
# |
| 110 |
connection slave; |
| 111 |
# Ensure the replica is fully idle before starting transactions |
| 112 |
# Lock t1 on slave so the first received transaction does not complete/commit |
| 113 |
LOCK TABLES t1 WRITE; |
| 114 |
connection master; |
| 115 |
insert into t1 values (3); |
| 116 |
include/save_master_gtid.inc |
| 117 |
connection slave; |
| 118 |
# Waiting for first transaction to begin.. |
| 119 |
connection master; |
| 120 |
# Sleep 2 sec to create a gap between events |
| 121 |
INSERT INTO t2 VALUES (1); |
| 122 |
include/save_master_gtid.inc |
| 123 |
connection slave; |
| 124 |
# Waiting for second transaction to begin.. |
| 125 |
connection slave; |
| 126 |
UNLOCK TABLES; |
| 127 |
include/sync_with_master_gtid.inc |
| 128 |
# |
| 129 |
# Cleanup |
| 130 |
connection master; |
| 131 |
DROP TABLE t1, t2; |
| 132 |
include/save_master_gtid.inc |
| 133 |
connection slave; |
| 134 |
include/sync_with_master_gtid.inc |
| 135 |
include/stop_slave.inc |
| 136 |
set @@GLOBAL.debug_dbug= ""; |
| 137 |
set @@GLOBAL.slave_parallel_mode= "$save_parallel_mode"; |
| 138 |
include/start_slave.inc |
| 139 |
include/rpl_end.inc |
| 140 |
# End of rpl_parallel_sbm.test |