MediaWiki  1.27.2
LoadBalancer Class Reference

Database load balancing object. More...

Inheritance diagram for LoadBalancer:
Collaboration diagram for LoadBalancer:

Public Member Functions

 __construct (array $params)
 
 allowLagged ($mode=null)
 Disables/enables lag checks. More...
 
 clearLagTimeCache ()
 Clear the cache for slag lag delay times. More...
 
 closeAll ()
 Close all open connections. More...
 
 closeConnection ($conn)
 Close a connection Using this function makes sure the LoadBalancer knows the connection is closed. More...
 
 commitAll ($fname=__METHOD__)
 Commit transactions on all open connections. More...
 
 commitMasterChanges ($fname=__METHOD__)
 Issue COMMIT only on master, only if queries were done on connection. More...
 
 forEachOpenConnection ($callback, array $params=[])
 Call a function with each open connection object. More...
 
 getAnyOpenConnection ($i)
 Get any open connection to a given server index, local or foreign Returns false if there is no connection open. More...
 
 getConnection ($i, $groups=[], $wiki=false)
 Get a connection by index This is the main entry point for this class. More...
 
 getConnectionRef ($db, $groups=[], $wiki=false)
 Get a database connection handle reference. More...
 
 getLaggedSlaveMode ($wiki=false)
 
 getLagTimes ($wiki=false)
 Get an estimate of replication lag (in seconds) for each server. More...
 
 getLazyConnectionRef ($db, $groups=[], $wiki=false)
 Get a database connection handle reference without connecting yet. More...
 
 getMasterPos ()
 Get the current master position for chronology control purposes. More...
 
 getMaxLag ($wiki=false)
 Get the hostname and lag time of the most-lagged slave. More...
 
 getReaderIndex ($group=false, $wiki=false)
 Get the index of the reader connection, which may be a slave This takes into account load ratios and lag times. More...
 
 getReadOnlyReason ($wiki=false)
 
 getServerCount ()
 Get the number of defined servers (not the number of open connections) More...
 
 getServerInfo ($i)
 Return the server info structure for a given index, or false if the index is invalid. More...
 
 getServerName ($i)
 Get the host name or IP address of the server with the specified index Prefer a readable name if available. More...
 
 getWriterIndex ()
 
 hasMasterChanges ()
 Determine if there are pending changes in a transaction by this thread. More...
 
 hasMasterConnection ()
 
 hasOrMadeRecentMasterChanges ($age=null)
 Check if this load balancer object had any recent or still pending writes issued against it by this PHP thread. More...
 
 haveIndex ($i)
 Returns true if the specified index is a valid server index. More...
 
 isNonZeroLoad ($i)
 Returns true if the specified index is valid and has non-zero load. More...
 
 laggedSlaveUsed ()
 
 lastMasterChangeTimestamp ()
 Get the timestamp of the latest write query done by this thread. More...
 
 openConnection ($i, $wiki=false)
 Open a connection to the server given by the specified index Index must be an actual index into the array. More...
 
 parentInfo ($x=null)
 Get or set arbitrary data used by the parent object, usually an LBFactory. More...
 
 pendingMasterChangeCallers ()
 Get the list of callers that have pending master changes. More...
 
 pingAll ()
 
 reuseConnection ($conn)
 Mark a foreign connection as being available for reuse under a different DB name or prefix. More...
 
 rollbackMasterChanges ($fname=__METHOD__)
 Issue ROLLBACK only on master, only if queries were done on connection. More...
 
 safeGetLag (IDatabase $conn)
 Get the lag in seconds for a given connection, or zero if this load balancer does not have replication enabled. More...
 
 safeWaitForMasterPos (IDatabase $conn, $pos=false, $timeout=10)
 Wait for a slave DB to reach a specified master position. More...
 
 setServerInfo ($i, array $serverInfo)
 Sets the server info structure for the given index. More...
 
 waitFor ($pos)
 Set the master wait position If a DB_SLAVE connection has been opened already, waits Otherwise sets a variable telling it to wait if such a connection is opened. More...
 
 waitForAll ($pos, $timeout=null)
 Set the master wait position and wait for ALL slaves to catch up to it. More...
 
 waitForOne ($pos, $timeout=null)
 Set the master wait position and wait for a "generic" slave to catch up to it. More...
 
 waitTimeout ($value=null)
 

Protected Member Functions

 doWait ($index, $open=false, $timeout=null)
 Wait for a given slave to catch up to the master pos stored in $this. More...
 
 reallyOpenConnection ($server, $dbNameOverride=false)
 Really opens a connection. More...
 

Protected Attributes

TransactionProfiler $trxProfiler
 

Private Member Functions

 getLoadMonitor ()
 Get a LoadMonitor instance. More...
 
 getRandomNonLagged (array $loads, $wiki=false, $maxLag=self::MAX_LAG)
 
 isOpen ($index)
 Test if the specified index represents an open connection. More...
 
 openForeignConnection ($i, $wiki)
 Open a connection to a foreign DB, or return one if it is already open. More...
 
 reportConnectionError ()
 

Private Attributes

integer $connsOpened = 0
 Total connections opened. More...
 
bool $laggedSlaveMode = false
 Whether the generic reader fell back to a lagged slave. More...
 
bool $mAllowLagged
 Whether to disregard slave lag as a factor in slave selection. More...
 
array[] $mConns
 Map of (local/foreignUsed/foreignFree => server index => DatabaseBase array) More...
 
bool DatabaseBase $mErrorConnection
 Database connection that caused a problem. More...
 
array[] $mGroupLoads
 Map of (group => server index => weight) More...
 
string $mLastError = 'Unknown error'
 The last DB selection or connection error. More...
 
LoadMonitor $mLoadMonitor
 
string $mLoadMonitorClass
 The LoadMonitor subclass name. More...
 
array $mLoads
 Map of (server index => weight) More...
 
array $mParentInfo
 LBFactory information. More...
 
integer $mReadIndex
 The generic (not query grouped) slave index (of $mServers) More...
 
array[] $mServers
 Map of (server index => server config array) More...
 
bool DBMasterPos $mWaitForPos
 False if not set. More...
 
integer $mWaitTimeout
 Seconds to spend waiting on slave lag to resolve. More...
 
string bool $readOnlyReason = false
 Reason the LB is read-only or false if not. More...
 
bool $slavesDownMode = false
 Whether the generic reader fell back to a lagged slave. More...
 
BagOStuff $srvCache
 

Detailed Description

Database load balancing object.

Todo:
document

Definition at line 30 of file LoadBalancer.php.

Constructor & Destructor Documentation

LoadBalancer::__construct ( array  $params)
Parameters
array$paramsArray with keys:
  • servers : Required. Array of server info structures.
  • loadMonitor : Name of a class used to fetch server lag and load.
  • readOnlyReason : Reason the master DB is read-only if so [optional]
Exceptions
MWException

Definition at line 87 of file LoadBalancer.php.

References as, and ObjectCache\getLocalServerInstance().

Member Function Documentation

LoadBalancer::allowLagged (   $mode = null)

Disables/enables lag checks.

Parameters
null | bool$mode
Returns
bool

Definition at line 1248 of file LoadBalancer.php.

References $mAllowLagged.

LoadBalancer::clearLagTimeCache ( )

Clear the cache for slag lag delay times.

This is only used for testing

Definition at line 1404 of file LoadBalancer.php.

References getLoadMonitor().

LoadBalancer::closeAll ( )

Close all open connections.

Definition at line 982 of file LoadBalancer.php.

References as.

LoadBalancer::closeConnection (   $conn)

Close a connection Using this function makes sure the LoadBalancer knows the connection is closed.

If you use $conn->close() directly, the load balancer won't update its state.

Parameters
DatabaseBase$conn

Definition at line 1005 of file LoadBalancer.php.

References $connsOpened, and as.

Referenced by doWait().

LoadBalancer::commitAll (   $fname = __METHOD__)

Commit transactions on all open connections.

Parameters
string$fnameCaller name

Definition at line 1029 of file LoadBalancer.php.

References $fname, and as.

LoadBalancer::commitMasterChanges (   $fname = __METHOD__)

Issue COMMIT only on master, only if queries were done on connection.

Parameters
string$fnameCaller name

Definition at line 1046 of file LoadBalancer.php.

References $fname, as, and getWriterIndex().

LoadBalancer::doWait (   $index,
  $open = false,
  $timeout = null 
)
protected

Wait for a given slave to catch up to the master pos stored in $this.

Parameters
int$indexServer index
bool$openCheck the server even if a new connection has to be made
int$timeoutMax seconds to wait; default is mWaitTimeout
Returns
bool

Definition at line 446 of file LoadBalancer.php.

References $key, $mWaitTimeout, closeConnection(), getAnyOpenConnection(), getServerName(), openConnection(), IExpiringStore\TTL_DAY, wfBacktrace(), and wfDebugLog().

Referenced by getReaderIndex(), waitFor(), waitForAll(), and waitForOne().

LoadBalancer::forEachOpenConnection (   $callback,
array  $params = [] 
)

Call a function with each open connection object.

Parameters
callable$callback
array$params

Definition at line 1281 of file LoadBalancer.php.

References $params, and as.

Referenced by LBFactory\commitMasterChanges(), and JobRunner\commitMasterChanges().

LoadBalancer::getAnyOpenConnection (   $i)

Get any open connection to a given server index, local or foreign Returns false if there is no connection open.

Parameters
int$i
Returns
DatabaseBase|bool False on failure

Definition at line 429 of file LoadBalancer.php.

References as.

Referenced by doWait(), getMasterPos(), isOpen(), ChronologyProtector\shutdownLB(), and waitFor().

LoadBalancer::getConnection (   $i,
  $groups = [],
  $wiki = false 
)

Get a connection by index This is the main entry point for this class.

Parameters
int$iServer index
array | string | bool$groupsQuery group(s), or false for the generic reader
string | bool$wikiWiki ID, or false for the current wiki
Exceptions
MWException
Returns
DatabaseBase

Definition at line 515 of file LoadBalancer.php.

References $connsOpened, $mLastError, array(), as, DB_MASTER, DB_SLAVE, getReaderIndex(), getReadOnlyReason(), getWriterIndex(), Profiler\instance(), openConnection(), reportConnectionError(), and wfWikiID().

Referenced by getConnectionRef(), getLaggedSlaveMode(), and safeWaitForMasterPos().

LoadBalancer::getConnectionRef (   $db,
  $groups = [],
  $wiki = false 
)

Get a database connection handle reference.

The handle's methods wrap simply wrap those of a DatabaseBase handle

See also
LoadBalancer::getConnection() for parameter information
Parameters
int$db
array | string | bool$groupsQuery group(s), or false for the generic reader
string | bool$wikiWiki ID, or false for the current wiki
Returns
DBConnRef

Definition at line 641 of file LoadBalancer.php.

References getConnection().

LoadBalancer::getLaggedSlaveMode (   $wiki = false)
Note
This method will trigger a DB connection if not yet done
Parameters
string | bool$wikiWiki ID, or false for the current wiki
Returns
bool Whether the generic connection for reads is highly "lagged"

Definition at line 1195 of file LoadBalancer.php.

References $e, $laggedSlaveMode, DB_SLAVE, getConnection(), getServerCount(), and reuseConnection().

Referenced by getReadOnlyReason().

LoadBalancer::getLagTimes (   $wiki = false)

Get an estimate of replication lag (in seconds) for each server.

Results are cached for a short time in memcached/process cache

Values may be "false" if replication is too broken to estimate

Parameters
string | bool$wiki
Returns
int[] Map of (server index => float|int|bool)

Definition at line 1333 of file LoadBalancer.php.

References getLoadMonitor(), and getServerCount().

Referenced by getMaxLag(), and getRandomNonLagged().

LoadBalancer::getLazyConnectionRef (   $db,
  $groups = [],
  $wiki = false 
)

Get a database connection handle reference without connecting yet.

The handle's methods wrap simply wrap those of a DatabaseBase handle

See also
LoadBalancer::getConnection() for parameter information
Parameters
int$db
array | string | bool$groupsQuery group(s), or false for the generic reader
string | bool$wikiWiki ID, or false for the current wiki
Returns
DBConnRef

Definition at line 657 of file LoadBalancer.php.

Referenced by reallyOpenConnection().

LoadBalancer::getLoadMonitor ( )
private

Get a LoadMonitor instance.

Returns
LoadMonitor

Definition at line 146 of file LoadBalancer.php.

References $mLoadMonitor, and $mLoadMonitorClass.

Referenced by clearLagTimeCache(), getLagTimes(), and getReaderIndex().

LoadBalancer::getMasterPos ( )

Get the current master position for chronology control purposes.

Returns
mixed

Definition at line 960 of file LoadBalancer.php.

References getAnyOpenConnection().

LoadBalancer::getMaxLag (   $wiki = false)

Get the hostname and lag time of the most-lagged slave.

This is useful for maintenance scripts that need to throttle their updates. May attempt to open connections to slaves on the default DB. If there is no lag, the maximum lag will be reported as -1.

Parameters
bool | string$wikiWiki ID, or false for the default database
Returns
array ( host, max lag, index of max lagged host )

Definition at line 1302 of file LoadBalancer.php.

References as, getLagTimes(), and getServerCount().

LoadBalancer::getRandomNonLagged ( array  $loads,
  $wiki = false,
  $maxLag = self::MAX_LAG 
)
private
Parameters
array$loads
bool | string$wikiWiki to get non-lagged for
int$maxLagRestrict the maximum allowed lag to this many seconds
Returns
bool|int|string

Definition at line 170 of file LoadBalancer.php.

References as, getLagTimes(), getServerName(), ArrayUtils\pickRandom(), and wfDebugLog().

Referenced by getReaderIndex().

LoadBalancer::getReaderIndex (   $group = false,
  $wiki = false 
)

Get the index of the reader connection, which may be a slave This takes into account load ratios and lag times.

It should always return a consistent index during a given invocation

Side effect: opens connections to databases

Parameters
string | bool$groupQuery group, or false for the generic reader
string | bool$wikiWiki ID, or false for the current wiki
Exceptions
MWException
Returns
bool|int|string

Definition at line 224 of file LoadBalancer.php.

References $mLoads, $mReadIndex, $wgDBtype, doWait(), getLoadMonitor(), getRandomNonLagged(), getServerName(), getWriterIndex(), global, openConnection(), ArrayUtils\pickRandom(), reuseConnection(), and wfDebugLog().

Referenced by getConnection().

LoadBalancer::getReadOnlyReason (   $wiki = false)
Note
This method may trigger a DB connection if not yet done
Parameters
string | bool$wikiWiki ID, or false for the current wiki
Returns
string|bool Reason the master is read-only or false if it is not
Since
1.27

Definition at line 1227 of file LoadBalancer.php.

References $readOnlyReason, and getLaggedSlaveMode().

Referenced by getConnection().

LoadBalancer::getServerCount ( )

Get the number of defined servers (not the number of open connections)

Returns
int

Definition at line 911 of file LoadBalancer.php.

Referenced by getLaggedSlaveMode(), getLagTimes(), getMaxLag(), ChronologyProtector\initLB(), safeGetLag(), safeWaitForMasterPos(), and ChronologyProtector\shutdownLB().

LoadBalancer::getServerInfo (   $i)

Return the server info structure for a given index, or false if the index is invalid.

Parameters
int$i
Returns
array|bool

Definition at line 938 of file LoadBalancer.php.

LoadBalancer::getServerName (   $i)

Get the host name or IP address of the server with the specified index Prefer a readable name if available.

Parameters
string$i
Returns
string

Definition at line 921 of file LoadBalancer.php.

References $name.

Referenced by doWait(), getRandomNonLagged(), getReaderIndex(), ChronologyProtector\initLB(), LBFactory\logMultiDbTransaction(), openConnection(), reallyOpenConnection(), LBFactory\shutdownChronologyProtector(), and ChronologyProtector\shutdownLB().

LoadBalancer::hasMasterChanges ( )

Determine if there are pending changes in a transaction by this thread.

Since
1.23
Returns
bool

Definition at line 1107 of file LoadBalancer.php.

References as, and getWriterIndex().

Referenced by LBFactory\hasMasterChanges(), and hasOrMadeRecentMasterChanges().

LoadBalancer::hasMasterConnection ( )
Returns
bool Whether a master connection is already open
Since
1.24

Definition at line 1098 of file LoadBalancer.php.

References getWriterIndex(), and isOpen().

LoadBalancer::hasOrMadeRecentMasterChanges (   $age = null)

Check if this load balancer object had any recent or still pending writes issued against it by this PHP thread.

Parameters
float$ageHow many seconds ago is "recent" [defaults to mWaitTimeout]
Returns
bool
Since
1.25

Definition at line 1151 of file LoadBalancer.php.

References hasMasterChanges(), and lastMasterChangeTimestamp().

Referenced by LBFactory\hasOrMadeRecentMasterChanges().

LoadBalancer::haveIndex (   $i)

Returns true if the specified index is a valid server index.

Parameters
string$i
Returns
bool

Definition at line 892 of file LoadBalancer.php.

LoadBalancer::isNonZeroLoad (   $i)

Returns true if the specified index is valid and has non-zero load.

Parameters
string$i
Returns
bool

Definition at line 902 of file LoadBalancer.php.

LoadBalancer::isOpen (   $index)
private

Test if the specified index represents an open connection.

Parameters
int$indexServer index
Access:
private
Returns
bool

Definition at line 787 of file LoadBalancer.php.

References getAnyOpenConnection().

Referenced by hasMasterConnection().

LoadBalancer::laggedSlaveUsed ( )
Note
This method will never cause a new DB connection
Returns
bool Whether any generic connection used for reads was highly "lagged"
Since
1.27

Definition at line 1217 of file LoadBalancer.php.

References $laggedSlaveMode.

Referenced by LBFactory\laggedSlaveUsed().

LoadBalancer::lastMasterChangeTimestamp ( )

Get the timestamp of the latest write query done by this thread.

Since
1.25
Returns
float|bool UNIX timestamp or false

Definition at line 1128 of file LoadBalancer.php.

References as, and getWriterIndex().

Referenced by hasOrMadeRecentMasterChanges().

LoadBalancer::openConnection (   $i,
  $wiki = false 
)

Open a connection to the server given by the specified index Index must be an actual index into the array.

If the server is already open, returns it.

On error, returns false, and the connection which caused the error will be available via $this->mErrorConnection.

Parameters
int$iServer index
string | bool$wikiWiki ID, or false for the current wiki
Returns
DatabaseBase|bool Returns false on errors

Definition at line 673 of file LoadBalancer.php.

References getServerName(), openForeignConnection(), reallyOpenConnection(), and wfDebugLog().

Referenced by doWait(), getConnection(), and getReaderIndex().

LoadBalancer::openForeignConnection (   $i,
  $wiki 
)
private

Open a connection to a foreign DB, or return one if it is already open.

Increments a reference count on the returned connection which locks the connection to the requested wiki. This reference count can be decremented by calling reuseConnection().

If a connection is open to the appropriate server already, but with the wrong database, it will be switched to the right database and returned, as long as it has been freed first with reuseConnection().

On error, returns false, and the connection which caused the error will be available via $this->mErrorConnection.

Parameters
int$iServer index
string$wikiWiki ID to open
Returns
DatabaseBase

Definition at line 723 of file LoadBalancer.php.

References key, list, reallyOpenConnection(), wfDebug(), wfHostname(), and wfSplitWikiID().

Referenced by openConnection().

LoadBalancer::parentInfo (   $x = null)

Get or set arbitrary data used by the parent object, usually an LBFactory.

Parameters
mixed$x
Returns
mixed

Definition at line 160 of file LoadBalancer.php.

References wfSetVar().

Referenced by ChronologyProtector\initLB(), and ChronologyProtector\shutdownLB().

LoadBalancer::pendingMasterChangeCallers ( )

Get the list of callers that have pending master changes.

Returns
array
Since
1.27

Definition at line 1164 of file LoadBalancer.php.

References as, and getWriterIndex().

Referenced by LBFactory\logMultiDbTransaction().

LoadBalancer::pingAll ( )
Returns
bool

Definition at line 1260 of file LoadBalancer.php.

References $success, and as.

LoadBalancer::reallyOpenConnection (   $server,
  $dbNameOverride = false 
)
protected

Really opens a connection.

Uncached. Returns a Database object whether or not the connection was successful.

Access:
private
Parameters
array$server
bool$dbNameOverride
Exceptions
MWException
Returns
DatabaseBase

Definition at line 805 of file LoadBalancer.php.

References $e, DB_MASTER, DatabaseBase\factory(), getLazyConnectionRef(), getServerName(), wfBacktrace(), and wfDebugLog().

Referenced by openConnection(), and openForeignConnection().

LoadBalancer::reportConnectionError ( )
private
Exceptions
DBConnectionError
Returns
bool

Definition at line 848 of file LoadBalancer.php.

References $context, $mErrorConnection, $mLastError, and wfLogDBError().

Referenced by getConnection().

LoadBalancer::reuseConnection (   $conn)

Mark a foreign connection as being available for reuse under a different DB name or prefix.

This mechanism is reference-counted, and must be called the same number of times as getConnection() to work.

Parameters
DatabaseBase$conn
Exceptions
MWException

Definition at line 590 of file LoadBalancer.php.

References wfDebug().

Referenced by getLaggedSlaveMode(), and getReaderIndex().

LoadBalancer::rollbackMasterChanges (   $fname = __METHOD__)

Issue ROLLBACK only on master, only if queries were done on connection.

Parameters
string$fnameCaller name
Exceptions
DBExpectedError
Since
1.23

Definition at line 1067 of file LoadBalancer.php.

References $e, $fname, as, getWriterIndex(), and MWExceptionHandler\logException().

LoadBalancer::safeGetLag ( IDatabase  $conn)

Get the lag in seconds for a given connection, or zero if this load balancer does not have replication enabled.

This should be used in preference to Database::getLag() in cases where replication may not be in use, since there is no way to determine if replication is in use at the connection level without running potentially restricted queries such as SHOW SLAVE STATUS. Using this function instead of Database::getLag() avoids a fatal error in this case on many installations.

Parameters
IDatabase$conn
Returns
int|bool Returns false on error

Definition at line 1356 of file LoadBalancer.php.

References IDatabase\getLag(), and getServerCount().

LoadBalancer::safeWaitForMasterPos ( IDatabase  $conn,
  $pos = false,
  $timeout = 10 
)

Wait for a slave DB to reach a specified master position.

This will connect to the master to get an accurate position if $pos is not given

Parameters
IDatabase$connSlave DB
DBMasterPos | bool$posMaster position; default: current position
integer$timeoutTimeout in seconds
Returns
bool Success
Since
1.27

Definition at line 1375 of file LoadBalancer.php.

References DB_MASTER, getConnection(), IDatabase\getLBInfo(), getServerCount(), IDatabase\masterPosWait(), wfBacktrace(), and wfDebugLog().

LoadBalancer::setServerInfo (   $i,
array  $serverInfo 
)

Sets the server info structure for the given index.

Entry at index $i is created if it doesn't exist

Parameters
int$i
array$serverInfo

Definition at line 952 of file LoadBalancer.php.

LoadBalancer::waitFor (   $pos)

Set the master wait position If a DB_SLAVE connection has been opened already, waits Otherwise sets a variable telling it to wait if such a connection is opened.

Parameters
DBMasterPos$pos

Definition at line 359 of file LoadBalancer.php.

References $mReadIndex, doWait(), and getAnyOpenConnection().

Referenced by ChronologyProtector\initLB().

LoadBalancer::waitForAll (   $pos,
  $timeout = null 
)

Set the master wait position and wait for ALL slaves to catch up to it.

Parameters
DBMasterPos$pos
int$timeoutMax seconds to wait; default is mWaitTimeout
Returns
bool Success (able to connect and no timeouts reached)

Definition at line 408 of file LoadBalancer.php.

References doWait().

Referenced by LBFactory\shutdownChronologyProtector().

LoadBalancer::waitForOne (   $pos,
  $timeout = null 
)

Set the master wait position and wait for a "generic" slave to catch up to it.

This can be used a faster proxy for waitForAll()

Parameters
DBMasterPos$pos
int$timeoutMax seconds to wait; default is mWaitTimeout
Returns
bool Success (able to connect and no timeouts reached)
Since
1.26

Definition at line 381 of file LoadBalancer.php.

References $mLoads, $mReadIndex, doWait(), getWriterIndex(), and ArrayUtils\pickRandom().

LoadBalancer::waitTimeout (   $value = null)
Parameters
mixed$value
Returns
mixed

Definition at line 1185 of file LoadBalancer.php.

References $value, and wfSetVar().

Member Data Documentation

integer LoadBalancer::$connsOpened = 0
private

Total connections opened.

Definition at line 68 of file LoadBalancer.php.

Referenced by closeConnection(), and getConnection().

bool LoadBalancer::$laggedSlaveMode = false
private

Whether the generic reader fell back to a lagged slave.

Definition at line 60 of file LoadBalancer.php.

Referenced by getLaggedSlaveMode(), and laggedSlaveUsed().

bool LoadBalancer::$mAllowLagged
private

Whether to disregard slave lag as a factor in slave selection.

Definition at line 40 of file LoadBalancer.php.

Referenced by allowLagged().

array [] LoadBalancer::$mConns
private

Map of (local/foreignUsed/foreignFree => server index => DatabaseBase array)

Definition at line 34 of file LoadBalancer.php.

bool DatabaseBase LoadBalancer::$mErrorConnection
private

Database connection that caused a problem.

Definition at line 54 of file LoadBalancer.php.

Referenced by reportConnectionError().

array [] LoadBalancer::$mGroupLoads
private

Map of (group => server index => weight)

Definition at line 38 of file LoadBalancer.php.

string LoadBalancer::$mLastError = 'Unknown error'
private

The last DB selection or connection error.

Definition at line 64 of file LoadBalancer.php.

Referenced by getConnection(), and reportConnectionError().

LoadMonitor LoadBalancer::$mLoadMonitor
private

Definition at line 49 of file LoadBalancer.php.

Referenced by getLoadMonitor().

string LoadBalancer::$mLoadMonitorClass
private

The LoadMonitor subclass name.

Definition at line 47 of file LoadBalancer.php.

Referenced by getLoadMonitor().

array LoadBalancer::$mLoads
private

Map of (server index => weight)

Definition at line 36 of file LoadBalancer.php.

Referenced by getReaderIndex(), and waitForOne().

array LoadBalancer::$mParentInfo
private

LBFactory information.

Definition at line 44 of file LoadBalancer.php.

integer LoadBalancer::$mReadIndex
private

The generic (not query grouped) slave index (of $mServers)

Definition at line 56 of file LoadBalancer.php.

Referenced by getReaderIndex(), waitFor(), and waitForOne().

array [] LoadBalancer::$mServers
private

Map of (server index => server config array)

Definition at line 32 of file LoadBalancer.php.

bool DBMasterPos LoadBalancer::$mWaitForPos
private

False if not set.

Definition at line 58 of file LoadBalancer.php.

integer LoadBalancer::$mWaitTimeout
private

Seconds to spend waiting on slave lag to resolve.

Definition at line 42 of file LoadBalancer.php.

Referenced by doWait().

string bool LoadBalancer::$readOnlyReason = false
private

Reason the LB is read-only or false if not.

Definition at line 66 of file LoadBalancer.php.

Referenced by getReadOnlyReason().

bool LoadBalancer::$slavesDownMode = false
private

Whether the generic reader fell back to a lagged slave.

Definition at line 62 of file LoadBalancer.php.

BagOStuff LoadBalancer::$srvCache
private

Definition at line 51 of file LoadBalancer.php.

TransactionProfiler LoadBalancer::$trxProfiler
protected

Definition at line 71 of file LoadBalancer.php.

Referenced by LoadBalancerSingle\__construct().


The documentation for this class was generated from the following file: