$class = $this->mLoadMonitorClass;
$this->mLoadMonitor = new $class( $this );
}
+
return $this->mLoadMonitor;
}
# No loads for this group, return false and the caller can use some other group
wfDebug( __METHOD__ . ": no loads for group $group\n" );
wfProfileOut( __METHOD__ );
+
return false;
}
} else {
# wants us to return false.
wfDebugLog( 'connect', __METHOD__ . ": pickRandom() returned false\n" );
wfProfileOut( __METHOD__ );
+
return false;
}
}
}
wfProfileOut( __METHOD__ );
+
return $i;
}
wfDebug( __METHOD__ . ": waiting $t us\n" );
usleep( $t );
wfProfileOut( __METHOD__ );
+
return $t;
}
return reset( $conns[$i] );
}
}
+
return false;
}
if ( !$conn ) {
if ( !$open ) {
wfDebug( __METHOD__ . ": no connection open\n" );
+
return false;
} else {
$conn = $this->openConnection( $index, '' );
if ( !$conn ) {
wfDebug( __METHOD__ . ": failed to open connection\n" );
+
return false;
}
}
if ( $result == -1 || is_null( $result ) ) {
# Timed out waiting for slave, use master instead
wfDebug( __METHOD__ . ": Timed out waiting for slave #$index pos {$this->mWaitForPos}\n" );
+
return false;
} else {
wfDebug( __METHOD__ . ": Done\n" );
+
return true;
}
}
if ( $i === false ) {
$this->mLastError = 'No working slave server: ' . $this->mLastError;
wfProfileOut( __METHOD__ );
+
return $this->reportConnectionError();
}
}
$conn = $this->openConnection( $i, $wiki );
if ( !$conn ) {
wfProfileOut( __METHOD__ );
+
return $this->reportConnectionError();
}
wfProfileOut( __METHOD__ );
+
return $conn;
}
}
if ( $serverIndex === null || $refCount === null ) {
wfDebug( __METHOD__ . ": this connection was not opened as a foreign connection\n" );
+
/**
* This can happen in code like:
* foreach ( $dbs as $db ) {
* When a connection to the local DB is opened in this way, reuseConnection()
* should be ignored
*/
+
return;
}
if ( $this->mConns['foreignUsed'][$serverIndex][$wiki] !== $conn ) {
if ( $wiki !== false ) {
$conn = $this->openForeignConnection( $i, $wiki );
wfProfileOut( __METHOD__ );
+
return $conn;
}
if ( isset( $this->mConns['local'][$i][0] ) ) {
}
}
wfProfileOut( __METHOD__ );
+
return $conn;
}
$conn->setLBInfo( 'foreignPoolRefCount', $refCount + 1 );
}
wfProfileOut( __METHOD__ );
+
return $conn;
}
if ( !is_integer( $index ) ) {
return false;
}
+
return (bool)$this->getAnyOpenConnection( $index );
}
if ( isset( $server['fakeMaster'] ) ) {
$db->setFakeMaster( true );
}
+
return $db;
}
wfLogDBError( "Connection error: {$this->mLastError} ({$server})\n" );
$conn->reportConnectionError( "{$this->mLastError} ({$server})" ); // throws DBConnectionError
}
+
return false; /* not reached */
}
$conn = $this->getAnyOpenConnection( $i );
if ( $conn ) {
wfDebug( "Master pos fetched from slave\n" );
+
return $conn->getSlavePos();
}
}
} else {
wfDebug( "Master pos fetched from master\n" );
+
return $masterConn->getMasterPos();
}
+
return false;
}
return $this->mAllowLagged;
}
$this->mAllowLagged = $mode;
+
return $this->mAllowLagged;
}
}
}
}
+
return $success;
}
}
}
}
+
return array( $host, $maxLag, $maxIndex );
}
$this->mLagTimes = $this->getLoadMonitor()->getLagTimes(
array_keys( $this->mServers ), $wiki );
}
+
return $this->mLagTimes;
}
list( $db, $groups, $wiki ) = $this->params;
$this->conn = $this->lb->getConnection( $db, $groups, $wiki );
}
+
return call_user_func_array( array( $this->conn, $name ), $arguments );
}