From 994743b79ec71947c9648c41336aa1160cf98b54 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Thu, 22 Feb 2007 02:12:46 +0000 Subject: [PATCH] debugging lost connections --- includes/Database.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/Database.php b/includes/Database.php index d295580834..d51553f8d2 100644 --- a/includes/Database.php +++ b/includes/Database.php @@ -521,7 +521,7 @@ class Database { } if ($this->mConn === false) { $iplus = $i + 1; - wfLogDBError("Connect loop error $iplus of $max ($server): " . mysql_errno() . " - " . mysql_error()."\n"); + #wfLogDBError("Connect loop error $iplus of $max ($server): " . mysql_errno() . " - " . mysql_error()."\n"); } } @@ -662,6 +662,11 @@ class Database { wfDebug( "Connection lost, reconnecting...\n" ); if ( $this->ping() ) { wfDebug( "Reconnected\n" ); + $sqlx = substr( $commentedSql, 0, 500 ); + $sqlx = strtr( $sqlx, "\t\n", ' ' ); + global $wgRequestTime; + $elapsed = round( microtime(true) - $wgRequestTime, 3 ); + wfLogDBError( "Connection lost and reconnected after {$elapsed}s, query: $sqlx\n" ); $ret = $this->doQuery( $commentedSql ); } else { wfDebug( "Failed\n" ); -- 2.20.1