Commit 8b15d0d4 authored by Brandon Nesterenko's avatar Brandon Nesterenko

MDEV-16091: Seconds_Behind_Master spikes to millions of seconds

This patch addresses two problems with
rpl.rpl_seconds_behind_master_spike

First, --sync_slave_with_master / select master_pos_wait
seems to have a bug where it will hang after all master
events have been executed.

This patch removes the sync_slave_with_master command from
the test, where it not required anyway as it is used to
declare explicit cleanup

Second, the test uses timestamps to ensure that the
Seconds_Behind_Master value does not point to a time too
far in the past. The checks of these timestamps were
too strict, because they could be slightly inconsistent
with the master and the SBM would be counted as invalid
when it was actually correct.

To fix this, a slight buffer was added to the check
to ensure the value is valid but still does not point
too far in the past

Reviewed By:
===========
Andrei Elkin <andrei.elkin@mariadb.com>
parent 50e66db0
......@@ -36,6 +36,5 @@ SET DEBUG_SYNC='RESET';
connection master;
DROP TABLE t1;
connection slave;
connection slave;
SET @@global.debug_dbug=$save_dbug;
include/rpl_end.inc
......@@ -61,7 +61,11 @@ select count(*)=1 from t1;
let $sbm= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1);
--let $t_now= `SELECT UNIX_TIMESTAMP()`
if(`select $sbm > $t_now - $t_master_events_logged`)
# Ensure Seconds_Behind_Master does not point beyond when we have proven the
# events we have proven to have executed. The extra second is needed as a
# buffer because the recorded times are not exact with when the events were
# recorded on the master.
if(`select $sbm > $t_now - $t_master_events_logged + 1`)
{
die "A relay log event was incorrectly used to set Seconds_Behind_Master";
}
......@@ -77,8 +81,6 @@ SET DEBUG_SYNC='RESET';
# Cleanup
--connection master
DROP TABLE t1;
--save_master_pos
--sync_slave_with_master
--connection slave
SET @@global.debug_dbug=$save_dbug;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment