summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-01-24 15:09:31 -0700
committerBrandon Nesterenko <brandon.nesterenko@mariadb.com>2022-01-25 15:32:23 -0700
commit8b15d0d4e019e1c9e0cd88d4fb8efe3a8c6fcd72 (patch)
treeeafa4b8fdd117238f4b0b18c24630462c35a2fe6
parent50e66db018d0d0ee49fd2b7196f30ed4594dc2b3 (diff)
downloadmariadb-git-8b15d0d4e019e1c9e0cd88d4fb8efe3a8c6fcd72.tar.gz
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>
-rw-r--r--mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result1
-rw-r--r--mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test8
2 files changed, 5 insertions, 4 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
index d164ea5434f..be18f95c2c0 100644
--- a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
@@ -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
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
index 36ddbd0dc9f..029625a09ad 100644
--- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
@@ -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;