| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
include/stop_slave.inc |
| 5 |
CHANGE MASTER TO MASTER_USE_GTID=NO; |
| 6 |
include/start_slave.inc |
| 7 |
# Future events must be logged at least 2 seconds after |
| 8 |
# the slave starts |
| 9 |
connection master; |
| 10 |
# Write events to ensure slave will be consistent with master |
| 11 |
create table t1 (a int); |
| 12 |
insert into t1 values (1); |
| 13 |
connection slave; |
| 14 |
# Enable breakpoints |
| 15 |
SET @save_dbug= @@GLOBAL.debug_dbug; |
| 16 |
SET @@GLOBAL.debug_dbug= |
| 17 |
'+d,pause_sql_thread_on_fde,negate_clock_diff_with_master'; |
| 18 |
connection master; |
| 19 |
# Flush logs on master forces slave to generate a Format description |
| 20 |
# event in its relay log |
| 21 |
flush logs; |
| 22 |
connection slave; |
| 23 |
# On the next FDE, the slave should have the master CREATE/INSERT events |
| 24 |
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; |
| 25 |
select count(*)=1 from t1; |
| 26 |
count(*)=1 |
| 27 |
1 |
| 28 |
# The relay log FDE has been processed - here we check to ensure it was |
| 29 |
# not considered in Seconds_Behind_Master calculation |
| 30 |
Seconds_Behind_Master = '0' |
| 31 |
# Safely resume slave SQL (worker) thread |
| 32 |
# Prove SQL thread is in state "debug sync point: now" |
| 33 |
SET @@global.debug_dbug="-d,pause_sql_thread_on_fde"; |
| 34 |
SET DEBUG_SYNC='now SIGNAL sql_thread_continue'; |
| 35 |
# Wait for SQL thread to continue into normal execution |
| 36 |
SET DEBUG_SYNC='RESET'; |
| 37 |
# |
| 38 |
# MDEV-29639 |
| 39 |
# When receiving an event after the SQL Thread idles, |
| 40 |
# Seconds_Behind_Master should not update before it updates |
| 41 |
# last_master_timestamp |
| 42 |
connection slave; |
| 43 |
include/stop_slave.inc |
| 44 |
set @@global.debug_dbug="+d,pause_sql_thread_on_next_event"; |
| 45 |
include/start_slave.inc |
| 46 |
connection master; |
| 47 |
insert into t1 values(2); |
| 48 |
include/save_master_gtid.inc |
| 49 |
connection slave; |
| 50 |
set debug_sync='now wait_for paused_on_event'; |
| 51 |
connection master; |
| 52 |
# Sleeping 1s to create a visible SBM gap between events |
| 53 |
insert into t1 values(3); |
| 54 |
include/save_master_gtid.inc |
| 55 |
connection slave; |
| 56 |
set debug_sync='now wait_for paused_on_event'; |
| 57 |
include/stop_slave.inc |
| 58 |
set debug_sync='RESET'; |
| 59 |
SET @@global.debug_dbug=$save_dbug; |
| 60 |
include/start_slave.inc |
| 61 |
include/sync_with_master_gtid.inc |
| 62 |
connection master; |
| 63 |
DROP TABLE t1; |
| 64 |
include/rpl_end.inc |