From 6e1a26327948cacd544340bb3af20df782c94c85 Mon Sep 17 00:00:00 2001 From: Domas Mituzas Date: Wed, 21 Jun 2006 16:34:56 +0000 Subject: [PATCH] fix lag detection - do not assume that second 'system user' line gives that value, better use first system user thread with db selected. --- includes/Database.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/includes/Database.php b/includes/Database.php index 9bb92e0984..7af8bd99d1 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -1812,14 +1812,18 @@ class Database { # dubious, but unfortunately there's no easy rigorous way $slaveThreads = 0; while ( $row = $this->fetchObject( $res ) ) { - if ( $row->User == 'system user' ) { - if ( ++$slaveThreads == 2 ) { - # This is it, return the time (except -ve) - if ( $row->Time > 0x7fffffff ) { - return false; - } else { - return $row->Time; - } + /* This should work for most situations - when default db + * for thread is not specified, it had no events executed, + * and therefore it doesn't know yet how lagged it is. + * + * Relay log I/O thread does not select databases. + */ + if ( $row->User == 'system user' && $row->db != '' ) { + # This is it, return the time (except -ve) + if ( $row->Time > 0x7fffffff ) { + return false; + } else { + return $row->Time; } } } -- 2.20.1