From 07cd19aeee112edad98832621b3f0b7b1d6f69a5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 17 Aug 2017 12:31:23 -0700 Subject: [PATCH] Make mysql getHeartbeatData() method not count query/RTT in estimate Optimize for the common case where lag does not strictly increase during trip times instead of being pessimistic. Change-Id: Ibb0e3faad23862d397e1cc2a9f7e2a8293fa5f2b --- includes/libs/rdbms/database/DatabaseMysqlBase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/libs/rdbms/database/DatabaseMysqlBase.php b/includes/libs/rdbms/database/DatabaseMysqlBase.php index 991e0c6660..692ddb70b8 100644 --- a/includes/libs/rdbms/database/DatabaseMysqlBase.php +++ b/includes/libs/rdbms/database/DatabaseMysqlBase.php @@ -778,6 +778,8 @@ abstract class DatabaseMysqlBase extends Database { * @see https://www.percona.com/doc/percona-toolkit/2.1/pt-heartbeat.html */ protected function getHeartbeatData( array $conds ) { + // Query time and trip time are not counted + $nowUnix = microtime( true ); // Do not bother starting implicit transactions here $this->clearFlag( self::DBO_TRX, self::REMEMBER_PRIOR ); try { @@ -793,7 +795,7 @@ abstract class DatabaseMysqlBase extends Database { $this->restoreFlags(); } - return [ $row ? $row->ts : null, microtime( true ) ]; + return [ $row ? $row->ts : null, $nowUnix ]; } protected function getApproximateLagStatus() { -- 2.20.1