| 1 |
############################################################################### |
| 2 |
# Bug#23532304 SECONDS_BEHIND_MASTER REPORTS IO_THREAD TIME WHEN USING MTS & |
| 3 |
# ROTATING RELAY-LOG |
| 4 |
# Problem: The value of 'Seconds_Behind_Master' (SBM) reports distorted number |
| 5 |
# when rotating a relay-log. |
| 6 |
# |
| 7 |
# Steps to reproduce: |
| 8 |
# 1) Fake that I/O thread is started 3 minutes ago using a debug point. |
| 9 |
# 2) Flush the logs on the master which would have generated fake rotate |
| 10 |
# event |
| 11 |
# 3) While the fake rotate event is getting executing, calculate the SBM |
| 12 |
# 4) Compare the executed SBM that it is not greater than or equal to I/O |
| 13 |
# thread's active time. |
| 14 |
# 5) Clean the debug point. |
| 15 |
# |
| 16 |
############################################################################### |
| 17 |
--source include/have_debug_sync.inc |
| 18 |
--let rpl_skip_start_slave=1 |
| 19 |
--source include/master-slave.inc |
| 20 |
|
| 21 |
# Step-1 Set sync debug point to calculate sbm exactly after fake |
| 22 |
# rotate log event. |
| 23 |
--source include/rpl_connection_slave.inc |
| 24 |
SET @save_global_debug=@@GLOBAL.DEBUG; |
| 25 |
# This debug point internally fake that IO thread is started 3 minutes ago. |
| 26 |
SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event'; |
| 27 |
# Start slave threads after enabling the debug point. |
| 28 |
--disable_warnings |
| 29 |
--source include/start_slave.inc |
| 30 |
--enable_warnings |
| 31 |
|
| 32 |
# Step-2 Flush logs on master which will generate a fake rotate event. |
| 33 |
--source include/rpl_connection_master.inc |
| 34 |
FLUSH LOGS; |
| 35 |
|
| 36 |
# Step-3 There will be two fake rotate events (first one while the initial setup |
| 37 |
# in master-slave.inc and second one due to FLUSH LOGS execution on master). |
| 38 |
# The following will test SBM calculation while both events are getting |
| 39 |
# executed. |
| 40 |
--source include/rpl_connection_slave.inc |
| 41 |
--let $iter=0 |
| 42 |
while ($iter < 2) |
| 43 |
{ |
| 44 |
# Step-4: Calcualte SBM while fake rotate log event is getting executed. |
| 45 |
# It should be approximately zero (some times little more than zero |
| 46 |
# if this test is run on a slow pb2 machine). Comparing with the |
| 47 |
# I/O thread age that it should be atleast less |
| 48 |
# than the age of I/O thread. |
| 49 |
SET DEBUG_SYNC="now wait_for signal.reached"; |
| 50 |
let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1); |
| 51 |
--let $assert_text= Seconds Behind Master should be less than IO_THREAD's time. |
| 52 |
--let $assert_cond= $sbm < 180 |
| 53 |
--source include/assert.inc |
| 54 |
SET DEBUG_SYNC="now signal signal.done_sbm_calculation"; |
| 55 |
--inc $iter |
| 56 |
} |
| 57 |
|
| 58 |
# Step-5: Cleanup |
| 59 |
SET @@GLOBAL.DEBUG=@save_global_debug; |
| 60 |
|
| 61 |
--source include/rpl_end.inc |