Bug #94356 Contribution by Facebook: Fix time granularity in dump thread
Submitted: 15 Feb 2019 23:13 Modified: 17 Apr 2019 11:53
Reporter: FBContrib Admin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:8.0.13 OS:Any
Assigned to: CPU Architecture:Any

[15 Feb 2019 23:13] FBContrib Admin
Description:
Background innformation provided by Facebook:

Dump thread used second granularity to decide whether heartbeat needs to be sent to slaves. With milli-second heartbeat configuration on slaves, this caused dump thread to send heartbeat events for every skipped event. This significantly increases slave start time. Fix this by increasing the granularity.

Fixes upstream bug: https://bugs.mysql.com/bug.php?id=81164

Use case:

We use sub-second heartbeats to detect failures quickly and for our automation to be able to take action quickly, supporting SLAs requirements, etc. When sub-second heartbeats are enabled, they encounter a problem as described in https://bugs.mysql.com/bug.php?id=81164.

Repo: https://github.com/mysql/mysql-server
Patch on top of 8.0.13: https://github.com/mysql/mysql-server/commit/e4924f36486f971f8a04252e01c803457a2c72f7

How to repeat:
See description

Suggested fix:
See contribution code attached
[15 Feb 2019 23:13] FBContrib Admin
Fix time granularity in dump thread 
(*) This code is contributed under the Facebook agreement

Contribution: fb_patch_104.txt (text/plain), 2.88 KiB.

[17 Apr 2019 11:53] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.18:

The heartbeat interval for a replication slave, which is controlled by the MASTER_HEARTBEAT_PERIOD option of the CHANGE MASTER TO statement, can be specified with a resolution in milliseconds. Previously, the master's binary log dump thread used a granularity of seconds to calculate whether a heartbeat signal should be sent to the slave, causing excessive heartbeat activity in the case of multiple skipped events. To remove this issue, all heartbeat-related calculations by the master and slave are now carried out using a granularity of nanoseconds for precision. Thanks to Facebook for the contribution.
[28 Jun 2019 11:05] MySQL Verification Team
Bug #81164 marked as duplicate of this one.