MediaWiki
1.28.0
|
Trivial LoadBalancer that always returns an injected connection handle. More...
Public Member Functions | |
__construct (array $params) | |
Public Member Functions inherited from LoadBalancer | |
__construct (array $params) | |
Construct a manager of IDatabase connection objects. More... | |
__destruct () | |
allowLagged ($mode=null) | |
Disables/enables lag checks. More... | |
approveMasterChanges (array $options) | |
Perform all pre-commit checks for things like replication safety. More... | |
beginMasterChanges ($fname=__METHOD__) | |
Flush any master transaction snapshots and set DBO_TRX (if DBO_DEFAULT is set) More... | |
closeAll () | |
Close all open connections. More... | |
closeConnection (IDatabase $conn) | |
Close a connection. 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... | |
finalizeMasterChanges () | |
Perform all pre-commit callbacks that remain part of the atomic transactions and disable any post-commit callbacks until runMasterPostTrxCallbacks() More... | |
flushReplicaSnapshots ($fname=__METHOD__) | |
Commit all replica DB transactions so as to flush any REPEATABLE-READ or SSI snapshot. 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... | |
forEachOpenReplicaConnection ($callback, array $params=[]) | |
Call a function with each open replica DB 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=[], $domain=false) | |
getConnectionRef ($db, $groups=[], $domain=false) | |
Get a database connection handle reference. More... | |
getLaggedReplicaMode ($domain=false) | |
getLaggedSlaveMode ($domain=false) | |
getLagTimes ($domain=false) | |
Get an estimate of replication lag (in seconds) for each server. More... | |
getLazyConnectionRef ($db, $groups=[], $domain=false) | |
Get a database connection handle reference without connecting yet. More... | |
getMasterPos () | |
Get the current master position for chronology control purposes. More... | |
getMaxLag ($domain=false) | |
Get the hostname and lag time of the most-lagged replica DB. More... | |
getReaderIndex ($group=false, $domain=false) | |
Get the index of the reader connection, which may be a replica DB This takes into account load ratios and lag times. More... | |
getReadOnlyReason ($domain=false, IDatabase $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... | |
laggedReplicaUsed () | |
laggedSlaveUsed () | |
lastMasterChangeTimestamp () | |
Get the timestamp of the latest write query done by this thread. More... | |
openConnection ($i, $domain=false) | |
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... | |
runMasterPostTrxCallbacks ($type) | |
Issue all pending post-COMMIT/ROLLBACK callbacks. 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 replica DB to reach a specified master position. More... | |
setDomainPrefix ($prefix) | |
Set a new table prefix for the existing local domain ID for testing. More... | |
setServerInfo ($i, array $serverInfo) | |
Sets the server info structure for the given index. More... | |
setTableAliases (array $aliases) | |
Make certain table names use their own database, schema, and table prefix when passed into SQL queries pre-escaped and without a qualified database name. More... | |
setTransactionListener ($name, callable $callback=null) | |
Set a callback via IDatabase::setTransactionListener() on all current and future master connections of this load balancer. More... | |
suppressTransactionEndCallbacks () | |
Suppress all pending post-COMMIT/ROLLBACK callbacks. More... | |
waitFor ($pos) | |
Set the master wait position If a DB_REPLICA 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 replica DBs to catch up to it. More... | |
waitForOne ($pos, $timeout=null) | |
Set the master wait position and wait for a "generic" replica DB to catch up to it. More... | |
Static Public Member Functions | |
static | newFromConnection (IDatabase $db, array $params=[]) |
Protected Member Functions | |
reallyOpenConnection (array $server, $dbNameOverride=false) | |
Protected Member Functions inherited from LoadBalancer | |
doWait ($index, $open=false, $timeout=null) | |
Wait for a given replica DB to catch up to the master pos stored in $this. More... | |
getScopedPHPBehaviorForCommit () | |
Make PHP ignore user aborts/disconnects until the returned value leaves scope. More... | |
reallyOpenConnection (array $server, $dbNameOverride=false) | |
Really opens a connection. More... | |
Private Attributes | |
IDatabase | $db |
Additional Inherited Members | |
Protected Attributes inherited from LoadBalancer | |
string | $agent |
Agent name for query profiling. More... | |
bool | $cliMode |
Whether this PHP instance is for a CLI script. More... | |
LoggerInterface | $connLogger |
LoggerInterface | $perfLogger |
object string | $profiler |
Class name or object With profileIn/profileOut methods. More... | |
LoggerInterface | $queryLogger |
LoggerInterface | $replLogger |
TransactionProfiler | $trxProfiler |
Trivial LoadBalancer that always returns an injected connection handle.
Definition at line 27 of file LoadBalancerSingle.php.
LoadBalancerSingle::__construct | ( | array | $params | ) |
array | $params | An associative array with one member:
|
Implements ILoadBalancer.
Definition at line 35 of file LoadBalancerSingle.php.
IDatabase | $db | Live connection handle |
array | $params | Parameter map to LoadBalancerSingle::__constructs() |
Definition at line 67 of file LoadBalancerSingle.php.
Definition at line 71 of file LoadBalancerSingle.php.
References $db.
|
private |
Definition at line 29 of file LoadBalancerSingle.php.
Referenced by newFromConnection(), and reallyOpenConnection().