private $mGroupLoads;
/** @var bool Whether to disregard replica DB lag as a factor in replica DB selection */
private $mAllowLagged;
- /** @var integer Seconds to spend waiting on replica DB lag to resolve */
+ /** @var int Seconds to spend waiting on replica DB lag to resolve */
private $mWaitTimeout;
/** @var array The LoadMonitor configuration */
private $loadMonitorConfig;
/** @var Database DB connection object that caused a problem */
private $errorConnection;
- /** @var integer The generic (not query grouped) replica DB index (of $mServers) */
+ /** @var int The generic (not query grouped) replica DB index (of $mServers) */
private $mReadIndex;
/** @var bool|DBMasterPos False if not set */
private $mWaitForPos;
private $mLastError = 'Unknown error';
/** @var string|bool Reason the LB is read-only or false if not */
private $readOnlyReason = false;
- /** @var integer Total connections opened */
+ /** @var int Total connections opened */
private $connsOpened = 0;
/** @var string|bool String if a requested DBO_TRX transaction round is active */
private $trxRoundId = false;
/** @var callable Exception logger */
private $errorLogger;
- /** @var boolean */
+ /** @var bool */
private $disabled = false;
- /** @var boolean */
+ /** @var bool */
private $chronProtInitialized = false;
- /** @var integer Warn when this many connection are held */
+ /** @var int Warn when this many connection are held */
const CONN_HELD_WARN_THRESHOLD = 10;
- /** @var integer Default 'max lag' when unspecified */
+ /** @var int Default 'max lag' when unspecified */
const MAX_LAG_DEFAULT = 10;
- /** @var integer Seconds to cache master server read-only status */
+ /** @var int Seconds to cache master server read-only status */
const TTL_CACHE_READONLY = 5;
const KEY_LOCAL = 'local';
throw new InvalidArgumentException( "Empty server array given to LoadBalancer" );
}
- /** @var $i int|bool Index of selected server */
+ /** @var int|bool $i Index of selected server */
$i = false;
- /** @var $laggedReplicaMode bool Whether server is considered lagged */
+ /** @var bool $laggedReplicaMode Whether server is considered lagged */
$laggedReplicaMode = false;
// Quickly look through the available servers for a server that meets criteria...
public function getAnyOpenConnection( $i ) {
foreach ( $this->mConns as $connsByServer ) {
if ( !empty( $connsByServer[$i] ) ) {
- /** @var $serverConns IDatabase[] */
+ /** @var IDatabase[] $serverConns */
$serverConns = $connsByServer[$i];
return reset( $serverConns );
$knownReachedPos->hasReached( $this->mWaitForPos )
) {
$this->replLogger->debug( __METHOD__ .
- ": replica DB $server known to be caught up (pos >= $knownReachedPos)." );
+ ': replica DB {dbserver} known to be caught up (pos >= $knownReachedPos).',
+ [ 'dbserver' => $server ] );
return true;
}
$conn = $this->getAnyOpenConnection( $index );
if ( !$conn ) {
if ( !$open ) {
- $this->replLogger->debug( __METHOD__ . ": no connection open for $server" );
+ $this->replLogger->debug( __METHOD__ . ': no connection open for {dbserver}',
+ [ 'dbserver' => $server ] );
return false;
} else {
$conn = $this->openConnection( $index, self::DOMAIN_ANY );
if ( !$conn ) {
- $this->replLogger->warning( __METHOD__ . ": failed to connect to $server" );
+ $this->replLogger->warning( __METHOD__ . ': failed to connect to {dbserver}',
+ [ 'dbserver' => $server ] );
return false;
}
}
}
- $this->replLogger->info( __METHOD__ . ": Waiting for replica DB $server to catch up..." );
+ $this->replLogger->info( __METHOD__ . ': Waiting for replica DB {dbserver} to catch up...',
+ [ 'dbserver' => $server ] );
$timeout = $timeout ?: $this->mWaitTimeout;
$result = $conn->masterPosWait( $this->mWaitForPos, $timeout );
*
* @param int $i Server index
* @param string $domain Domain ID to open
- * @param integer $flags Class CONN_* constant bitfield
+ * @param int $flags Class CONN_* constant bitfield
* @return Database
*/
private function openForeignConnection( $i, $domain, $flags = 0 ) {