|
MediaWiki master
|
Placeholder LoadBalancer that throws an error upon attempts to access connections. More...
Inherits Wikimedia\Rdbms\LoadBalancer.

Public Member Functions | ||||||||||||
| __construct (array $params=[]) | ||||||||||||
| getConnection ( $i, $groups=[], string|false $domain=false, $flags=0) | ||||||||||||
| getConnectionInternal ( $i, $groups=[], $domain=false, $flags=0) | ||||||||||||
| getMaintenanceConnectionRef ( $i, $groups=[], $domain=false, $flags=0) | ||||||||||||
Public Member Functions inherited from Wikimedia\Rdbms\LoadBalancer | ||||||||||||
| approvePrimaryChanges (int $maxWriteDuration, $fname=__METHOD__) | ||||||||||||
Perform all pre-commit checks for things like replication safety.Use this only for multi-database commits
| ||||||||||||
| beginPrimaryChanges ( $fname=__METHOD__) | ||||||||||||
Flush any primary transaction snapshots and set DBO_TRX (if DBO_DEFAULT is set)The DBO_TRX setting will be reverted to the default in each of these methods:
| ||||||||||||
| closeAll ( $fname=__METHOD__) | ||||||||||||
Close all open connections.
| ||||||||||||
| commitPrimaryChanges ( $fname=__METHOD__) | ||||||||||||
Issue COMMIT on all open primary connections to flush changes and view snapshots.
| ||||||||||||
| disable ( $fname=__METHOD__) | ||||||||||||
Close all connections and disable this load balancer.Any attempt to open a new connection will result in a DBAccessError.
| ||||||||||||
| explicitTrxActive () | ||||||||||||
Determine whether an explicit transaction is active on any open primary connection.
| ||||||||||||
| finalizePrimaryChanges ( $fname=__METHOD__) | ||||||||||||
Run pre-commit callbacks and defer execution of post-commit callbacks.Use this only for multi-database commits
| ||||||||||||
| flushPrimarySessions ( $fname=__METHOD__) | ||||||||||||
Release/destroy session-level named locks, table locks, and temp tables.Only call this function right after calling rollbackPrimaryChanges()
| ||||||||||||
| flushPrimarySnapshots ( $fname=__METHOD__) | ||||||||||||
Commit all primary DB transactions so as to flush any REPEATABLE-READ or SSI snapshots.An error will be thrown if a connection has pending writes or callbacks
| ||||||||||||
| flushReplicaSnapshots ( $fname=__METHOD__) | ||||||||||||
Commit all replica DB transactions so as to flush any REPEATABLE-READ or SSI snapshots.
| ||||||||||||
| getAnyOpenConnection ( $i, $flags=0) | ||||||||||||
| getClusterName () | ||||||||||||
| Get the name of the overall cluster of database servers managing the dataset. | ||||||||||||
| getLagTimes () | ||||||||||||
Get an estimate of replication lag (in seconds) for each server.Results are cached for a short time in memcached/process cacheValues may be "false" if replication is too broken to estimate
| ||||||||||||
| getLocalDomainID () | ||||||||||||
| Get the local (and default) database domain ID of connection handles. | ||||||||||||
| getMaxLag () | ||||||||||||
Get the name and lag time of the most-lagged replica server.This is useful for maintenance scripts that need to throttle their updates. May attempt to open connections to replica DBs on the default DB. If there is no lag, the maximum lag will be reported as -1.
| ||||||||||||
| getPrimaryPos () | ||||||||||||
Get the current primary replication position.
| ||||||||||||
| getReaderIndex ( $group=false) | ||||||||||||
Get the specific server index of the reader connection for a given group.This takes into account load ratios and lag times. It should return a consistent index during the life time of the load balancer. This initially checks replica DBs for connectivity to avoid returning an unusable server. This means that connections might be attempted by calling this method (usually one at the most but possibly more). Subsequent calls with the same $group will not need to make new connection attempts since the acquired connection for each group is preserved.
| ||||||||||||
| getReadOnlyReason () | ||||||||||||
| ||||||||||||
| getServerAttributes ( $i) | ||||||||||||
Get basic attributes of the server with the specified index without connecting.
| ||||||||||||
| getServerConnection ( $i, $domain, $flags=0) | ||||||||||||
Get a DB handle for a specific server index.This is an internal utility method for methods like LoadBalancer::getConnectionInternal() and DBConnRef to create the underlying connection to a concrete server.The following is the responsibility of the caller:
| ||||||||||||
| getServerCount () | ||||||||||||
Get the number of servers defined in configuration.
| ||||||||||||
| getServerInfo ( $i) | ||||||||||||
Return the server configuration map for the server with the specified index.
| ||||||||||||
| getServerName ( $i) | ||||||||||||
Get the readable name of the server with the specified index.
| ||||||||||||
| getServerType ( $i) | ||||||||||||
Get the RDBMS type of the server with the specified index (e.g."mysql", "sqlite")
| ||||||||||||
| hasOrMadeRecentPrimaryChanges ( $age=null) | ||||||||||||
Check if this load balancer object had any recent or still pending writes issued against it by this PHP thread.
| ||||||||||||
| hasPrimaryChanges () | ||||||||||||
Whether there are pending changes or callbacks in a transaction by this thread.
| ||||||||||||
| hasPrimaryConnection () | ||||||||||||
| ||||||||||||
| hasReplicaServers () | ||||||||||||
Whether there are any replica servers configured.This scans the list of servers defined in configuration, checking for:
| ||||||||||||
| hasStreamingReplicaServers () | ||||||||||||
Whether any replica servers use streaming replication from the primary server.This scans the list of servers defined in configuration, checking for:
| ||||||||||||
| laggedReplicaUsed () | ||||||||||||
Whether a highly "lagged" replica database connection was queried.
| ||||||||||||
| lastPrimaryChangeTimestamp () | ||||||||||||
Get the last time that a tracked connection was used to commit a write.
| ||||||||||||
| pendingPrimaryChangeCallers () | ||||||||||||
Get the list of callers that have pending primary changes.
| ||||||||||||
| pingAll () | ||||||||||||
| ||||||||||||
| reconfigure (array $params) | ||||||||||||
| Apply updated configuration. | ||||||||||||
| redefineLocalDomain ( $domain) | ||||||||||||
Close all connection and redefine the local domain for testing or schema creation.
| ||||||||||||
| resolveDomainID (DatabaseDomain|string|false $domain) | ||||||||||||
| ||||||||||||
| rollbackPrimaryChanges ( $fname=__METHOD__) | ||||||||||||
Issue ROLLBACK only on primary, only if queries were done on connection.
| ||||||||||||
| runPrimaryTransactionIdleCallbacks ( $fname=__METHOD__) | ||||||||||||
Consume and run all pending post-COMMIT/ROLLBACK callbacks and commit dangling transactions.
| ||||||||||||
| runPrimaryTransactionListenerCallbacks ( $fname=__METHOD__) | ||||||||||||
Run all recurring post-COMMIT/ROLLBACK listener callbacks.
| ||||||||||||
| setDefaultGroupName (string $defaultGroup) | ||||||||||||
| Set the default group name for all load balancers. | ||||||||||||
| setDomainAliases (array $aliases) | ||||||||||||
| Convert certain database domains to alternative ones. | ||||||||||||
| setLocalDomainPrefix ( $prefix) | ||||||||||||
Set a new table prefix for the existing local domain ID for testing.
| ||||||||||||
| setMockTime (&$time) | ||||||||||||
| 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. | ||||||||||||
| setTempTablesOnlyMode ( $value, $domain) | ||||||||||||
Indicate whether the tables on this domain are only temporary tables for testing.In "temporary tables mode", the CONN_TRX_AUTOCOMMIT flag is ignored
| ||||||||||||
| setTransactionListener ( $name, ?callable $callback=null) | ||||||||||||
Set a callback via IDatabase::setTransactionListener() on all current and future primary connections of this load balancer.
| ||||||||||||
| waitForAll (DBPrimaryPos $pos, $timeout=null) | ||||||||||||
Set the primary wait position and wait for ALL replica DBs to catch up to it.This method is only intended for use a throttling mechanism for high-volume updates. Unlike waitFor(), failure does not effect laggedReplicaUsed().
| ||||||||||||
| waitForPrimaryPos (IDatabase $conn) | ||||||||||||
Wait for a replica DB to reach a specified primary position.If $conn is not a replica server connection, then this will return true. Otherwise, if $pos is not provided, this will connect to the primary server to get an accurate position.
| ||||||||||||
Protected Member Functions | |
| reallyOpenConnection ( $i, DatabaseDomain $domain, array $lbInfo) | |
Protected Member Functions inherited from Wikimedia\Rdbms\LoadBalancer | |
| configure (array $params) | |
| getConnLogContext (IDatabase $conn, array $extras=[]) | |
| Create a log context to pass to PSR-3 logger functions. | |
| getExistingReaderIndex ( $group) | |
| Get the server index chosen for DB_REPLICA connections for the given query group. | |
| resolveDomainInstance (DatabaseDomain|string|false $domain) | |
| sanitizeConnectionFlags ( $flags, $domain) | |
| Sanitize connection flags provided by a call to getConnection() | |
Additional Inherited Members | |
Public Attributes inherited from Wikimedia\Rdbms\ILoadBalancerForOwner | |
| const | STAGE_POSTCOMMIT_CALLBACKS = 'stage-postcommit-callbacks' |
| Manager of ILoadBalancer instances is running post-commit callbacks. | |
| const | STAGE_POSTROLLBACK_CALLBACKS = 'stage-postrollback-callbacks' |
| Manager of ILoadBalancer instances is running post-rollback callbacks. | |
Public Attributes inherited from Wikimedia\Rdbms\ILoadBalancer | |
| const | CONN_SILENCE_ERRORS = 4 |
| Yield null on connection failure instead of throwing an exception. | |
| const | CONN_TRX_AUTOCOMMIT = 1 |
| Yield a tracked autocommit-mode handle (reuse existing ones) | |
| const | CONN_UNTRACKED_GAUGE = 2 |
| Yield an untracked, low-timeout, autocommit-mode handle (to gauge server health) | |
| const | DB_PRIMARY = -2 |
| Request a primary, write-enabled DB connection. | |
| const | DB_REPLICA = -1 |
| Request a replica DB connection. | |
| const | DOMAIN_ANY = '' |
| Domain specifier when no specific database needs to be selected. | |
| const | GROUP_GENERIC = '' |
| The generic query group. | |
Placeholder LoadBalancer that throws an error upon attempts to access connections.
This is useful when running code with no config file present, e.g. during installation.
Definition at line 18 of file LoadBalancerDisabled.php.
| Wikimedia\Rdbms\LoadBalancerDisabled::__construct | ( | array | $params = [] | ) |
| array | $params | Parameter map with keys:
|
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 20 of file LoadBalancerDisabled.php.
| Wikimedia\Rdbms\LoadBalancerDisabled::getConnection | ( | $i, | |
| $groups = [], | |||
| string|false | $domain = false, | ||
| $flags = 0 ) |
| int | $i | Specific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index |
| string[] | string | $groups | Query group(s) in preference order; [] for the default group |
| string | false | $domain | DB domain ID or false for the local domain |
| int | $flags | Bitfield of CONN_* class constants |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 56 of file LoadBalancerDisabled.php.
| Wikimedia\Rdbms\LoadBalancerDisabled::getConnectionInternal | ( | $i, | |
| $groups = [], | |||
| $domain = false, | |||
| $flags = 0 ) |
| int | $i | Specific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index |
| string[] | string | $groups | Query group(s) in preference order; [] for the default group |
| string | false | $domain | DB domain ID or false for the local domain |
| int | $flags | Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT) |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 68 of file LoadBalancerDisabled.php.
| Wikimedia\Rdbms\LoadBalancerDisabled::getMaintenanceConnectionRef | ( | $i, | |
| $groups = [], | |||
| $domain = false, | |||
| $flags = 0 ) |
| int | $i | Specific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index |
| string[] | string | $groups | Query group(s) in preference order; [] for the default group |
| string | false | $domain | DB domain ID or false for the local domain |
| int | $flags | Bitfield of CONN_* class constants |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 80 of file LoadBalancerDisabled.php.
|
protected |
| int | $i | |
| DatabaseDomain | $domain | |
| array | $lbInfo |
Reimplemented from Wikimedia\Rdbms\LoadBalancer.
Definition at line 44 of file LoadBalancerDisabled.php.