MediaWiki
master
|
Trivial LoadBalancer that always returns an injected connection handle. More...
Public Member Functions | |
__construct (array $params) | |
You probably want to use newFromConnection instead. More... | |
__destruct () | |
reuseConnection (IDatabase $conn) | |
![]() | |
approvePrimaryChanges (int $maxWriteDuration, $fname=__METHOD__) | |
Perform all pre-commit checks for things like replication safety. More... | |
beginPrimaryChanges ( $fname=__METHOD__) | |
Flush any primary transaction snapshots and set DBO_TRX (if DBO_DEFAULT is set) More... | |
closeAll ( $fname=__METHOD__) | |
Close all open connections. More... | |
closeConnection (IDatabase $conn) | |
Close a connection. More... | |
commitPrimaryChanges ( $fname=__METHOD__) | |
Issue COMMIT on all open primary connections to flush changes and view snapshots. More... | |
disable ( $fname=__METHOD__) | |
Close all connections and disable this load balancer. More... | |
explicitTrxActive () | |
Determine whether an explicit transaction is active on any open primary connection. More... | |
finalizePrimaryChanges ( $fname=__METHOD__) | |
Run pre-commit callbacks and defer execution of post-commit callbacks. More... | |
flushPrimarySessions ( $fname=__METHOD__) | |
Release/destroy session-level named locks, table locks, and temp tables. More... | |
flushPrimarySnapshots ( $fname=__METHOD__) | |
Commit all primary DB transactions so as to flush any REPEATABLE-READ or SSI snapshots. More... | |
flushReplicaSnapshots ( $fname=__METHOD__) | |
Commit all replica DB transactions so as to flush any REPEATABLE-READ or SSI snapshots. More... | |
getAnyOpenConnection ( $i, $flags=0) | |
Get an existing DB handle to the given server index (on any domain) More... | |
getClusterName () | |
Get the name of the overall cluster of database servers managing the dataset. More... | |
getConnection ( $i, $groups=[], $domain=false, $flags=0) | |
Get a lazy-connecting database handle for a specific or virtual (DB_PRIMARY/DB_REPLICA) server index. More... | |
getConnectionInternal ( $i, $groups=[], $domain=false, $flags=0) | |
getConnectionRef ( $i, $groups=[], $domain=false, $flags=0) | |
getLagTimes () | |
Get an estimate of replication lag (in seconds) for each server. More... | |
getLocalDomainID () | |
Get the local (and default) database domain ID of connection handles. More... | |
getMaintenanceConnectionRef ( $i, $groups=[], $domain=false, $flags=0) | |
Get a DB handle, suitable for migrations and schema changes, for a server index. More... | |
getMaxLag () | |
Get the name and lag time of the most-lagged replica server. More... | |
getPrimaryPos () | |
Get the current primary replication position. More... | |
getReaderIndex ( $group=false) | |
Get the specific server index of the reader connection for a given group. More... | |
getReadOnlyReason ( $domain=false) | |
getReplicaResumePos () | |
Get the highest DB replication position for chronology control purposes. More... | |
getServerAttributes ( $i) | |
Get basic attributes of the server with the specified index without connecting. More... | |
getServerConnection ( $i, $domain, $flags=0) | |
Get a DB handle for a specific server index. More... | |
getServerCount () | |
Get the number of servers defined in configuration. More... | |
getServerInfo ( $i) | |
Return the server configuration map for the server with the specified index. More... | |
getServerName ( $i) | |
Get the readable name of the server with the specified index. More... | |
getServerType ( $i) | |
Get the RDBMS type of the server with the specified index (e.g. More... | |
getWriterIndex () | |
Get the specific server index of the "writer server". More... | |
hasOrMadeRecentPrimaryChanges ( $age=null) | |
Check if this load balancer object had any recent or still pending writes issued against it by this PHP thread. More... | |
hasPrimaryChanges () | |
Whether there are pending changes or callbacks in a transaction by this thread. More... | |
hasPrimaryConnection () | |
hasReplicaServers () | |
Whether there are any replica servers configured. More... | |
hasStreamingReplicaServers () | |
Whether any replica servers use streaming replication from the primary server. More... | |
laggedReplicaUsed () | |
Whether a highly "lagged" replica database connection was queried. More... | |
lastPrimaryChangeTimestamp () | |
Get the timestamp of the latest write query done by this thread. More... | |
pendingPrimaryChangeCallers () | |
Get the list of callers that have pending primary changes. More... | |
pingAll () | |
reconfigure (array $params) | |
Apply updated configuration. More... | |
redefineLocalDomain ( $domain) | |
Close all connection and redefine the local domain for testing or schema creation. More... | |
resolveDomainID ( $domain) | |
rollbackPrimaryChanges ( $fname=__METHOD__) | |
Issue ROLLBACK only on primary, only if queries were done on connection. More... | |
runPrimaryTransactionIdleCallbacks ( $fname=__METHOD__) | |
Consume and run all pending post-COMMIT/ROLLBACK callbacks and commit dangling transactions. More... | |
runPrimaryTransactionListenerCallbacks ( $fname=__METHOD__) | |
Run all recurring post-COMMIT/ROLLBACK listener callbacks. More... | |
setDomainAliases (array $aliases) | |
Convert certain database domains to alternative ones. More... | |
setIndexAliases (array $aliases) | |
Convert certain index names to alternative names before querying the DB. More... | |
setLocalDomainPrefix ( $prefix) | |
Set a new table prefix for the existing local domain ID for testing. 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... | |
setTempTablesOnlyMode ( $value, $domain) | |
Indicate whether the tables on this domain are only temporary tables for testing. More... | |
setTransactionListener ( $name, callable $callback=null) | |
Set a callback via IDatabase::setTransactionListener() on all current and future primary connections of this load balancer. More... | |
waitFor (DBPrimaryPos $pos) | |
Set the primary position to reach before the next generic group DB query. More... | |
waitForAll (DBPrimaryPos $pos, $timeout=null) | |
Set the primary wait position and wait for ALL replica DBs to catch up to it. More... | |
waitForPrimaryPos (IDatabase $conn) | |
Wait for a replica DB to reach a specified primary position. More... | |
Static Public Member Functions | |
static | newFromConnection (IDatabase $db, array $params=[]) |
Protected Member Functions | |
reallyOpenConnection ( $i, DatabaseDomain $domain, array $lbInfo) | |
Open a new network connection to a server (uncached) More... | |
![]() | |
configure (array $params) | |
getConnLogContext (IDatabase $conn, array $extras=[]) | |
Create a log context to pass to PSR-3 logger functions. More... | |
getExistingReaderIndex ( $group) | |
Get the server index chosen for DB_REPLICA connections for the given query group. More... | |
resolveDomainInstance ( $domain) | |
Additional Inherited Members | |
![]() | |
const | MAX_LAG_DEFAULT = ServerInfo::MAX_LAG_DEFAULT |
Default 'maxLag' when unspecified. More... | |
![]() | |
const | STAGE_POSTCOMMIT_CALLBACKS = 'stage-postcommit-callbacks' |
Manager of ILoadBalancer instances is running post-commit callbacks. More... | |
const | STAGE_POSTROLLBACK_CALLBACKS = 'stage-postrollback-callbacks' |
Manager of ILoadBalancer instances is running post-rollback callbacks. More... | |
![]() | |
const | CONN_INTENT_WRITABLE = 8 |
Caller is requesting the primary DB server for possibly writes. More... | |
const | CONN_SILENCE_ERRORS = 4 |
Yield null on connection failure instead of throwing an exception. More... | |
const | CONN_TRX_AUTOCOMMIT = 2 |
Yield a tracked autocommit-mode handle (reuse existing ones) More... | |
const | CONN_UNTRACKED_GAUGE = 1 |
Yield an untracked, low-timeout, autocommit-mode handle (to gauge server health) More... | |
const | DB_MASTER = self::DB_PRIMARY |
Request a primary, write-enabled DB connection. More... | |
const | DB_PRIMARY = -2 |
Request a primary, write-enabled DB connection. More... | |
const | DB_REPLICA = -1 |
Request a replica DB connection. More... | |
const | DOMAIN_ANY = '' |
Domain specifier when no specific database needs to be selected. More... | |
const | GROUP_GENERIC = '' |
The generic query group. More... | |
Trivial LoadBalancer that always returns an injected connection handle.
Definition at line 29 of file LoadBalancerSingle.php.
Wikimedia\Rdbms\LoadBalancerSingle::__construct | ( | array | $params | ) |
You probably want to use newFromConnection instead.
array | $params | An associative array with one member:
|
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 39 of file LoadBalancerSingle.php.
References Wikimedia\Rdbms\Database\getDBname(), Wikimedia\Rdbms\Database\getServer(), Wikimedia\Rdbms\IReadableDatabase\getType(), and Wikimedia\Rdbms\Database\setLBInfo().
Wikimedia\Rdbms\LoadBalancerSingle::__destruct | ( | ) |
Definition at line 94 of file LoadBalancerSingle.php.
|
static |
IDatabase | $db | Live connection handle |
array | $params | Parameter map to LoadBalancerSingle::__constructs() |
Definition at line 74 of file LoadBalancerSingle.php.
References Wikimedia\Rdbms\IReadableDatabase\getDomainID().
|
protected |
Open a new network connection to a server (uncached)
Returns a Database object whether or not the connection was successful.
int | $i | Specific server index |
DatabaseDomain | $domain | Domain the connection is for, possibly unspecified |
array | $lbInfo | Additional information for setLBInfo() |
DBAccessError | |
InvalidArgumentException |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 82 of file LoadBalancerSingle.php.
Wikimedia\Rdbms\LoadBalancerSingle::reuseConnection | ( | IDatabase | $conn | ) |
IDatabase | $conn |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 90 of file LoadBalancerSingle.php.