Merge "Log to DBPerformance log when many LB connections are acquired"
[lhc/web/wiklou.git] / includes / db / DatabaseMysqlBase.php
index 430b20c..f02aa93 100644 (file)
@@ -58,7 +58,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
         */
        function open( $server, $user, $password, $dbName ) {
                global $wgAllDBsAreLocalhost, $wgSQLMode;
-               wfProfileIn( __METHOD__ );
 
                # Debugging hack -- fake cluster
                if ( $wgAllDBsAreLocalhost ) {
@@ -72,8 +71,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                $this->mPassword = $password;
                $this->mDBname = $dbName;
 
-               wfProfileIn( "dbconnect-$server" );
-
                # The kernel's default SYN retransmission period is far too slow for us,
                # so we use a short timeout plus a manual retry. Retrying means that a small
                # but finite rate of SYN packet loss won't cause user-visible errors.
@@ -82,15 +79,11 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                try {
                        $this->mConn = $this->mysqlConnect( $realServer );
                } catch ( Exception $ex ) {
-                       wfProfileOut( "dbconnect-$server" );
-                       wfProfileOut( __METHOD__ );
                        $this->restoreErrorHandler();
                        throw $ex;
                }
                $error = $this->restoreErrorHandler();
 
-               wfProfileOut( "dbconnect-$server" );
-
                # Always log connection errors
                if ( !$this->mConn ) {
                        if ( !$error ) {
@@ -107,8 +100,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                "Server: $server, User: $user, Password: " .
                                substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
 
-                       wfProfileOut( __METHOD__ );
-
                        $this->reportConnectionError( $error );
                }
 
@@ -126,8 +117,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                wfDebug( "Error selecting database $dbName on server {$this->mServer} " .
                                        "from client host " . wfHostname() . "\n" );
 
-                               wfProfileOut( __METHOD__ );
-
                                $this->reportConnectionError( "Error selecting database $dbName" );
                        }
                }
@@ -149,13 +138,11 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                                'method' => __METHOD__,
                                        ) )
                                );
-                               wfProfileOut( __METHOD__ );
                                $this->reportConnectionError( "Error setting sql_mode to $mode" );
                        }
                }
 
                $this->mOpened = true;
-               wfProfileOut( __METHOD__ );
 
                return true;
        }
@@ -671,7 +658,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                        return '0'; // http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html
                }
 
-               wfProfileIn( __METHOD__ );
                # Commit any open transactions
                $this->commit( __METHOD__, 'flush' );
 
@@ -680,18 +666,15 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
 
                        if ( $wait > $timeout * 1e6 ) {
                                wfDebug( "Fake slave timed out waiting for $pos ($wait us)\n" );
-                               wfProfileOut( __METHOD__ );
 
                                return -1;
                        } elseif ( $wait > 0 ) {
                                wfDebug( "Fake slave waiting $wait us\n" );
                                usleep( $wait );
-                               wfProfileOut( __METHOD__ );
 
                                return 1;
                        } else {
                                wfDebug( "Fake slave up to date ($wait us)\n" );
-                               wfProfileOut( __METHOD__ );
 
                                return 0;
                        }
@@ -711,8 +694,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                        }
                }
 
-               wfProfileOut( __METHOD__ );
-
                return $status;
        }