Log backtraces for DB reconnections
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 26 Nov 2014 01:10:46 +0000 (17:10 -0800)
committerBryanDavis <bdavis@wikimedia.org>
Wed, 3 Dec 2014 21:55:26 +0000 (21:55 +0000)
Change-Id: Ibe7badde80bf6a44e292b89fe6c085cbda5748e2

includes/db/Database.php

index 1124617..df04b6d 100644 (file)
@@ -1028,7 +1028,12 @@ abstract class DatabaseBase implements IDatabase {
                        $lastErrno = $this->lastErrno();
                        if ( $this->ping() ) {
                                global $wgRequestTime;
+
                                wfDebug( "Reconnected\n" );
+                               $server = $this->getServer();
+                               $msg = __METHOD__ . ": lost connection to $server; reconnected";
+                               wfDebugLog( 'DBPerformance', "$msg:\n" . wfBacktrace( true ) );
+
                                $sqlx = $wgDebugDumpSqlLength ? substr( $commentedSql, 0, $wgDebugDumpSqlLength )
                                        : $commentedSql;
                                $sqlx = strtr( $sqlx, "\t\n", '  ' );