Made master connection expectations actually work
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Mar 2015 21:18:18 +0000 (13:18 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Mar 2015 21:18:18 +0000 (13:18 -0800)
Bug: \96T86862
Change-Id: If918904c6c02ea83473dfaf34dfc2787ab610c6f

includes/db/Database.php
includes/db/LoadBalancer.php

index 1a7a97d..b3c81f9 100644 (file)
@@ -817,10 +817,6 @@ abstract class DatabaseBase implements IDatabase {
                if ( $user ) {
                        $this->open( $server, $user, $password, $dbName );
                }
-
-               $isMaster = !is_null( $this->getLBInfo( 'master' ) );
-               $trxProf = $this->getTransactionProfiler();
-               $trxProf->recordConnection( $this->mServer, $this->mDBname, $isMaster );
        }
 
        /**
index 917d703..dd95844 100644 (file)
@@ -756,6 +756,10 @@ class LoadBalancer {
                        $db = $e->db;
                }
 
+               $isMaster = !empty( $server['master'] );
+               $trxProf = Profiler::instance()->getTransactionProfiler();
+               $trxProf->recordConnection( $server['host'], $server['dbname'], $isMaster );
+
                $db->setLBInfo( $server );
                if ( isset( $server['fakeSlaveLag'] ) ) {
                        $db->setFakeSlaveLag( $server['fakeSlaveLag'] );