Details
-
New Feature
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
None
Description
Extend SHOW SLAVE STATUS, to display the variable mi->clock_diff_with_master.
Additionally, MTR tests which use Seconds_Behind_Master should be updated to adjust its value based on this variable. This will remove the need for the debug point "negate_clock_diff_with_master", and tests which rely on have_debug.inc for that purpose can be freed from that dependency.
Attachments
Issue Links
- relates to
-
MDEV-16091 Seconds_Behind_Master spikes to millions of seconds
-
- Closed
-
-
MDEV-30619 Parallel Slave SQL Thread Can Update Seconds_Behind_Master with Active Workers
-
- Closed
-
With more thought, I wonder if presenting this value may be problematic. I originally encountered this issue when an expected equivalence
Seconds_Behind_Master + SQL_Remaining_Delay == SQL_Delay
didn't hold true, because the mi->clock_diff_with_master variable is used to set Seconds_Behind_Master.
This value is calculated by comparing the primary's system clock, i.e. with
SELECT UNIX_TIMESTAMP()
against the current clock of the slave, with the granularity of seconds.
The issue in the MTR tests, was that the master could be queried for its timestamp just before ticking to the next second, and then by the time the replica checks its current timestamp, it has reached the next second. So mi->clock_diff_with_master would compute to "1", despite the master and slave using the same system clock.
In a real scenario, this seems like it could be problematic, as the replica and primary could be very close (within the NTP standard), yet we would report one second (or potentially more if the system scheduler is messed up), and falsely scare admins.
Elkin, knielsen do you have any thoughts?