MediaWiki
master
|
Database load balancing object. More...
Public Member Functions | |
__construct (array $params) | |
allowLagged ($mode=null) | |
Disables/enables lag checks. More... | |
approveMasterChanges (array $options) | |
Perform all pre-commit checks for things like replication safety. 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 on all master connections where writes where done. More... | |
disable () | |
Disable this load balancer. More... | |
forEachOpenConnection ($callback, array $params=[]) | |
Call a function with each open connection object. More... | |
forEachOpenMasterConnection ($callback, array $params=[]) | |
Call a function with each open connection object to a master. 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, DatabaseBase $conn=null) | |
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... | |
runMasterPostCommitCallbacks () | |
Issue all pending post-commit callbacks. More... | |
runMasterPreCommitCallbacks () | |
Perform all pre-commit callbacks that remain part of the atomic transactions and disable any post-commit callbacks until runMasterPostCommitCallbacks() 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... | |
masterRunningReadOnly ($wiki, DatabaseBase $conn=null) | |
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... | |
boolean | $disabled = false |
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 |
WANObjectCache | $wanCache |
LoadBalancer::__construct | ( | array | $params | ) |
array | $params | Array with keys:
|
MWException |
Definition at line 96 of file LoadBalancer.php.
References as, ObjectCache\getLocalServerInstance(), and ObjectCache\getMainWANInstance().
LoadBalancer::allowLagged | ( | $mode = null | ) |
Disables/enables lag checks.
null | bool | $mode |
Definition at line 1333 of file LoadBalancer.php.
References $mAllowLagged.
LoadBalancer::approveMasterChanges | ( | array | $options | ) |
Perform all pre-commit checks for things like replication safety.
array | $options | Includes:
|
DBTransactionError |
Definition at line 1081 of file LoadBalancer.php.
References $limit, $time, forEachOpenMasterConnection(), DatabaseBase\pendingWriteQueryDuration(), text, use, and wfMessage().
LoadBalancer::clearLagTimeCache | ( | ) |
Clear the cache for slag lag delay times.
This is only used for testing
Definition at line 1503 of file LoadBalancer.php.
References getLoadMonitor().
LoadBalancer::closeAll | ( | ) |
Close all open connections.
Definition at line 1011 of file LoadBalancer.php.
References DatabaseBase\close(), and forEachOpenConnection().
Referenced by disable().
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.
DatabaseBase | $conn |
Definition at line 1030 of file LoadBalancer.php.
References $connsOpened, and as.
Referenced by doWait().
LoadBalancer::commitAll | ( | $fname = __METHOD__ | ) |
Commit transactions on all open connections.
string | $fname | Caller name |
Definition at line 1054 of file LoadBalancer.php.
References $fname, DatabaseBase\commit(), forEachOpenConnection(), and use.
LoadBalancer::commitMasterChanges | ( | $fname = __METHOD__ | ) |
Issue COMMIT on all master connections where writes where done.
string | $fname | Caller name |
Definition at line 1100 of file LoadBalancer.php.
References $fname, DatabaseBase\commit(), forEachOpenMasterConnection(), use, and DatabaseBase\writesOrCallbacksPending().
LoadBalancer::disable | ( | ) |
Disable this load balancer.
All connections are closed, and any attempt to open a new connection will result in a DBAccessError.
Definition at line 1003 of file LoadBalancer.php.
References closeAll().
|
protected |
Wait for a given slave to catch up to the master pos stored in $this.
int | $index | Server index |
bool | $open | Check the server even if a new connection has to be made |
int | $timeout | Max seconds to wait; default is mWaitTimeout |
Definition at line 456 of file LoadBalancer.php.
References $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.
callable | $callback | |
array | $params |
Definition at line 1361 of file LoadBalancer.php.
Referenced by closeAll(), commitAll(), JobRunner\commitMasterChanges(), and pingAll().
LoadBalancer::forEachOpenMasterConnection | ( | $callback, | |
array | $params = [] |
||
) |
Call a function with each open connection object to a master.
callable | $callback | |
array | $params |
Definition at line 1378 of file LoadBalancer.php.
References $params, as, and getWriterIndex().
Referenced by approveMasterChanges(), commitMasterChanges(), runMasterPostCommitCallbacks(), and runMasterPreCommitCallbacks().
LoadBalancer::getAnyOpenConnection | ( | $i | ) |
Get any open connection to a given server index, local or foreign Returns false if there is no connection open.
int | $i |
Definition at line 439 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.
int | $i | Server index |
array | string | bool | $groups | Query group(s), or false for the generic reader |
string | bool | $wiki | Wiki ID, or false for the current wiki |
MWException |
Definition at line 525 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(), masterRunningReadOnly(), 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
int | $db | |
array | string | bool | $groups | Query group(s), or false for the generic reader |
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 651 of file LoadBalancer.php.
References getConnection().
LoadBalancer::getLaggedSlaveMode | ( | $wiki = false | ) |
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 1253 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
string | bool | $wiki |
Definition at line 1432 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
int | $db | |
array | string | bool | $groups | Query group(s), or false for the generic reader |
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 667 of file LoadBalancer.php.
Referenced by reallyOpenConnection().
|
private |
Get a LoadMonitor instance.
Definition at line 156 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.
Definition at line 978 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.
bool | string | $wiki | Wiki ID, or false for the default database |
Definition at line 1401 of file LoadBalancer.php.
References as, getLagTimes(), and getServerCount().
array | $loads | |
bool | string | $wiki | Wiki to get non-lagged for |
int | $maxLag | Restrict the maximum allowed lag to this many seconds |
Definition at line 180 of file LoadBalancer.php.
References as, getLagTimes(), getServerName(), ArrayUtils\pickRandom(), and wfDebugLog().
Referenced by getReaderIndex().
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
string | bool | $group | Query group, or false for the generic reader |
string | bool | $wiki | Wiki ID, or false for the current wiki |
MWException |
Definition at line 234 of file LoadBalancer.php.
References $laggedSlaveMode, $mLoads, $mReadIndex, $wgDBtype, doWait(), getLoadMonitor(), getRandomNonLagged(), getServerName(), getWriterIndex(), global, openConnection(), ArrayUtils\pickRandom(), reuseConnection(), and wfDebugLog().
Referenced by getConnection().
LoadBalancer::getReadOnlyReason | ( | $wiki = false , |
|
DatabaseBase | $conn = null |
||
) |
string | bool | $wiki | Wiki ID, or false for the current wiki |
DatabaseBase|null | DB master connection; used to avoid loops [optional] |
Definition at line 1286 of file LoadBalancer.php.
References $readOnlyReason, getLaggedSlaveMode(), and masterRunningReadOnly().
Referenced by getConnection().
LoadBalancer::getServerCount | ( | ) |
Get the number of defined servers (not the number of open connections)
Definition at line 929 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.
int | $i |
Definition at line 956 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.
string | $i |
Definition at line 939 of file LoadBalancer.php.
References $name.
Referenced by doWait(), getRandomNonLagged(), getReaderIndex(), ChronologyProtector\initLB(), LBFactory\logIfMultiDbTransaction(), masterRunningReadOnly(), openConnection(), reallyOpenConnection(), LBFactory\shutdownChronologyProtector(), and ChronologyProtector\shutdownLB().
LoadBalancer::getWriterIndex | ( | ) |
Definition at line 900 of file LoadBalancer.php.
Referenced by forEachOpenMasterConnection(), getConnection(), getReaderIndex(), hasMasterChanges(), hasMasterConnection(), ChronologyProtector\initLB(), lastMasterChangeTimestamp(), LBFactory\logIfMultiDbTransaction(), masterRunningReadOnly(), pendingMasterChangeCallers(), rollbackMasterChanges(), LBFactory\shutdownChronologyProtector(), ChronologyProtector\shutdownLB(), and waitForOne().
LoadBalancer::hasMasterChanges | ( | ) |
Determine if there are pending changes in a transaction by this thread.
Definition at line 1165 of file LoadBalancer.php.
References as, and getWriterIndex().
Referenced by LBFactory\hasMasterChanges(), and hasOrMadeRecentMasterChanges().
LoadBalancer::hasMasterConnection | ( | ) |
Definition at line 1156 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.
float | $age | How many seconds ago is "recent" [defaults to mWaitTimeout] |
Definition at line 1209 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.
string | $i |
Definition at line 910 of file LoadBalancer.php.
LoadBalancer::isNonZeroLoad | ( | $i | ) |
Returns true if the specified index is valid and has non-zero load.
string | $i |
Definition at line 920 of file LoadBalancer.php.
|
private |
Test if the specified index represents an open connection.
int | $index | Server index |
Definition at line 801 of file LoadBalancer.php.
References getAnyOpenConnection().
Referenced by hasMasterConnection().
LoadBalancer::laggedSlaveUsed | ( | ) |
Definition at line 1275 of file LoadBalancer.php.
References $laggedSlaveMode.
Referenced by LBFactory\laggedSlaveUsed().
LoadBalancer::lastMasterChangeTimestamp | ( | ) |
Get the timestamp of the latest write query done by this thread.
Definition at line 1186 of file LoadBalancer.php.
References as, and getWriterIndex().
Referenced by hasOrMadeRecentMasterChanges().
|
private |
string | $wiki | Wiki ID, or false for the current wiki |
DatabaseBase|null | DB master connectionl used to avoid loops [optional] |
Definition at line 1309 of file LoadBalancer.php.
References $cache, $e, $wanCache, DB_MASTER, getConnection(), getServerName(), getWriterIndex(), and use.
Referenced by getReadOnlyReason().
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.
int | $i | Server index |
string | bool | $wiki | Wiki ID, or false for the current wiki |
Definition at line 685 of file LoadBalancer.php.
References getServerName(), openForeignConnection(), reallyOpenConnection(), and wfDebugLog().
Referenced by doWait(), getConnection(), and getReaderIndex().
|
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.
int | $i | Server index |
string | $wiki | Wiki ID to open |
Definition at line 737 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.
mixed | $x |
Definition at line 170 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.
Definition at line 1222 of file LoadBalancer.php.
References as, and getWriterIndex().
Referenced by LBFactory\logIfMultiDbTransaction().
LoadBalancer::pingAll | ( | ) |
Definition at line 1345 of file LoadBalancer.php.
References $success, forEachOpenConnection(), DatabaseBase\ping(), and use.
|
protected |
Really opens a connection.
Uncached. Returns a Database object whether or not the connection was successful.
array | $server | |
bool | $dbNameOverride |
MWException |
Definition at line 819 of file LoadBalancer.php.
References $e, DB_MASTER, DatabaseBase\factory(), getLazyConnectionRef(), getServerName(), wfBacktrace(), and wfDebugLog().
Referenced by openConnection(), and openForeignConnection().
|
private |
DBConnectionError |
Definition at line 866 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.
DatabaseBase | $conn |
MWException |
Definition at line 600 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.
string | $fname | Caller name |
DBExpectedError |
Definition at line 1125 of file LoadBalancer.php.
References $e, $fname, as, getWriterIndex(), and MWExceptionHandler\logException().
LoadBalancer::runMasterPostCommitCallbacks | ( | ) |
Issue all pending post-commit callbacks.
Definition at line 1112 of file LoadBalancer.php.
References forEachOpenMasterConnection(), DatabaseBase\runOnTransactionIdleCallbacks(), DatabaseBase\setPostCommitCallbackSupression(), and IDatabase\TRIGGER_COMMIT.
LoadBalancer::runMasterPreCommitCallbacks | ( | ) |
Perform all pre-commit callbacks that remain part of the atomic transactions and disable any post-commit callbacks until runMasterPostCommitCallbacks()
Definition at line 1065 of file LoadBalancer.php.
References forEachOpenMasterConnection(), DatabaseBase\runOnTransactionPreCommitCallbacks(), and DatabaseBase\setPostCommitCallbackSupression().
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.
IDatabase | $conn |
Definition at line 1455 of file LoadBalancer.php.
References IDatabase\getLag(), and getServerCount().
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
IDatabase | $conn | Slave DB |
DBMasterPos | bool | $pos | Master position; default: current position |
integer | $timeout | Timeout in seconds |
Definition at line 1474 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
int | $i | |
array | $serverInfo |
Definition at line 970 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.
DBMasterPos | $pos |
Definition at line 369 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.
DBMasterPos | $pos | |
int | $timeout | Max seconds to wait; default is mWaitTimeout |
Definition at line 418 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()
DBMasterPos | $pos | |
int | $timeout | Max seconds to wait; default is mWaitTimeout |
Definition at line 391 of file LoadBalancer.php.
References $mLoads, $mReadIndex, doWait(), getWriterIndex(), and ArrayUtils\pickRandom().
LoadBalancer::waitTimeout | ( | $value = null | ) |
mixed | $value |
Definition at line 1243 of file LoadBalancer.php.
References $value, and wfSetVar().
|
private |
Total connections opened.
Definition at line 70 of file LoadBalancer.php.
Referenced by closeConnection(), and getConnection().
Definition at line 87 of file LoadBalancer.php.
|
private |
Whether the generic reader fell back to a lagged slave.
Definition at line 62 of file LoadBalancer.php.
Referenced by getLaggedSlaveMode(), getReaderIndex(), and laggedSlaveUsed().
|
private |
Whether to disregard slave lag as a factor in slave selection.
Definition at line 40 of file LoadBalancer.php.
Referenced by allowLagged().
|
private |
Map of (local/foreignUsed/foreignFree => server index => DatabaseBase array)
Definition at line 34 of file LoadBalancer.php.
|
private |
Database connection that caused a problem.
Definition at line 56 of file LoadBalancer.php.
Referenced by reportConnectionError().
|
private |
Map of (group => server index => weight)
Definition at line 38 of file LoadBalancer.php.
|
private |
The last DB selection or connection error.
Definition at line 66 of file LoadBalancer.php.
Referenced by getConnection(), and reportConnectionError().
|
private |
Definition at line 49 of file LoadBalancer.php.
Referenced by getLoadMonitor().
|
private |
The LoadMonitor subclass name.
Definition at line 47 of file LoadBalancer.php.
Referenced by getLoadMonitor().
|
private |
Map of (server index => weight)
Definition at line 36 of file LoadBalancer.php.
Referenced by getReaderIndex(), and waitForOne().
|
private |
LBFactory information.
Definition at line 44 of file LoadBalancer.php.
|
private |
The generic (not query grouped) slave index (of $mServers)
Definition at line 58 of file LoadBalancer.php.
Referenced by getReaderIndex(), waitFor(), and waitForOne().
|
private |
Map of (server index => server config array)
Definition at line 32 of file LoadBalancer.php.
|
private |
False if not set.
Definition at line 60 of file LoadBalancer.php.
|
private |
Seconds to spend waiting on slave lag to resolve.
Definition at line 42 of file LoadBalancer.php.
Referenced by doWait().
Reason the LB is read-only or false if not.
Definition at line 68 of file LoadBalancer.php.
Referenced by getReadOnlyReason().
|
private |
Whether the generic reader fell back to a lagged slave.
Definition at line 64 of file LoadBalancer.php.
|
private |
Definition at line 51 of file LoadBalancer.php.
|
protected |
Definition at line 73 of file LoadBalancer.php.
Referenced by LoadBalancerSingle\__construct().
|
private |
Definition at line 53 of file LoadBalancer.php.
Referenced by masterRunningReadOnly().