MediaWiki REL1_40
Wikimedia\Rdbms\LoadBalancerDisabled Class Reference

Trivial LoadBalancer that always fails. More...

Inherits Wikimedia\Rdbms\LoadBalancer.

Collaboration diagram for Wikimedia\Rdbms\LoadBalancerDisabled:

Public Member Functions

 __construct ( $params=[])
 
 getConnection ( $i, $groups=[], $domain=false, $flags=0)
 
 getConnectionInternal ( $i, $groups=[], $domain=false, $flags=0)
 
 getConnectionRef ( $i, $groups=[], $domain=false, $flags=0)
 
 getMaintenanceConnectionRef ( $i, $groups=[], $domain=false, $flags=0)
 
 reuseConnection (IDatabase $conn)
 
- Public Member Functions inherited from Wikimedia\Rdbms\LoadBalancer
 __construct (array $params)
 
 approvePrimaryChanges (int $maxWriteDuration, $fname=__METHOD__)
 Perform all pre-commit checks for things like replication safety.
 
 beginPrimaryChanges ( $fname=__METHOD__)
 Flush any primary transaction snapshots and set DBO_TRX (if DBO_DEFAULT is set)
 
 closeAll ( $fname=__METHOD__)
 Close all open connections.
 
 closeConnection (IDatabase $conn)
 Close a connection.
 
 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.
 
 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.
 
 flushPrimarySessions ( $fname=__METHOD__)
 Release/destroy session-level named locks, table locks, and temp tables.
 
 flushPrimarySnapshots ( $fname=__METHOD__)
 Commit all primary DB transactions so as to flush any REPEATABLE-READ or SSI snapshots.
 
 flushReplicaSnapshots ( $fname=__METHOD__)
 Commit all replica DB transactions so as to flush any REPEATABLE-READ or SSI snapshots.
 
 getAnyOpenConnection ( $i, $flags=0)
 Get an existing DB handle to the given server index (on any domain)
 
 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.
 
 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.
 
 getPrimaryPos ()
 Get the current primary replication position.
 
 getReaderIndex ( $group=false)
 Get the specific server index of the reader connection for a given group.
 
 getReadOnlyReason ( $domain=false)
 
 getReplicaResumePos ()
 Get the highest DB replication position for chronology control purposes.
 
 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.
 
 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.
 
 getWriterIndex ()
 Get the specific server index of the "writer server".
 
 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.
 
 hasStreamingReplicaServers ()
 Whether any replica servers use streaming replication from the primary server.
 
 laggedReplicaUsed ()
 Whether a highly "lagged" replica database connection was queried.
 
 lastPrimaryChangeTimestamp ()
 Get the timestamp of the latest write query done by this thread.
 
 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 ( $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.
 
 setDomainAliases (array $aliases)
 Convert certain database domains to alternative ones.
 
 setIndexAliases (array $aliases)
 Convert certain index names to alternative names before querying the DB.
 
 setLocalDomainPrefix ( $prefix)
 Set a new table prefix for the existing local domain ID for testing.
 
 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.
 
 setTransactionListener ( $name, callable $callback=null)
 Set a callback via IDatabase::setTransactionListener() on all current and future primary connections of this load balancer.
 
 waitFor (DBPrimaryPos $pos)
 Set the primary position to reach before the next generic group DB query.
 
 waitForAll (DBPrimaryPos $pos, $timeout=null)
 Set the primary wait position and wait for ALL replica DBs to catch up to it.
 
 waitForPrimaryPos (IDatabase $conn)
 Wait for a replica DB to reach a specified primary 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 ( $domain)
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Rdbms\LoadBalancer
const MAX_LAG_DEFAULT = ServerInfo::MAX_LAG_DEFAULT
 Default 'maxLag' when unspecified.
 
- 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_INTENT_WRITABLE = 8
 Caller is requesting the primary DB server for possibly writes.
 
const CONN_REFRESH_READ_ONLY = 16
 Bypass and update any server-side read-only mode state cache.
 
const CONN_SILENCE_ERRORS = 4
 Yield null on connection failure instead of throwing an exception.
 
const CONN_TRX_AUTOCOMMIT = 2
 Yield a tracked autocommit-mode handle (reuse existing ones)
 
const CONN_UNTRACKED_GAUGE = 1
 Yield an untracked, low-timeout, autocommit-mode handle (to gauge server health)
 
const DB_MASTER = self::DB_PRIMARY
 Request a primary, write-enabled DB connection.
 
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.
 

Detailed Description

Trivial LoadBalancer that always fails.

Useful when running code with no config file present, e.g. during the installation process.

Since
1.40

Definition at line 33 of file LoadBalancerDisabled.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\LoadBalancerDisabled::__construct ( $params = [])

Definition at line 35 of file LoadBalancerDisabled.php.

Member Function Documentation

◆ getConnection()

Wikimedia\Rdbms\LoadBalancerDisabled::getConnection ( $i,
$groups = [],
$domain = false,
$flags = 0 )
Parameters
int$iSpecific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index
string[] | string$groupsQuery group(s) in preference order; [] for the default group
string | false$domainDB domain ID or false for the local domain
int$flagsBitfield of CONN_* class constants
Returns
never

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 71 of file LoadBalancerDisabled.php.

◆ getConnectionInternal()

Wikimedia\Rdbms\LoadBalancerDisabled::getConnectionInternal ( $i,
$groups = [],
$domain = false,
$flags = 0 )
Access: internal
Only to be used by DBConnRef
Parameters
int$iSpecific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index
string[] | string$groupsQuery group(s) in preference order; [] for the default group
string | false$domainDB domain ID or false for the local domain
int$flagsBitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
Returns
never

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 83 of file LoadBalancerDisabled.php.

◆ getConnectionRef()

Wikimedia\Rdbms\LoadBalancerDisabled::getConnectionRef ( $i,
$groups = [],
$domain = false,
$flags = 0 )
Parameters
int$iSpecific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index
string[] | string$groupsQuery group(s) in preference order; [] for the default group
string | false$domainDB domain ID or false for the local domain
int$flagsBitfield of CONN_* class constants
Returns
never

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 95 of file LoadBalancerDisabled.php.

◆ getMaintenanceConnectionRef()

Wikimedia\Rdbms\LoadBalancerDisabled::getMaintenanceConnectionRef ( $i,
$groups = [],
$domain = false,
$flags = 0 )
Parameters
int$iSpecific (overrides $groups) or virtual (DB_PRIMARY/DB_REPLICA) server index
string[] | string$groupsQuery group(s) in preference order; [] for the default group
string | false$domainDB domain ID or false for the local domain
int$flagsBitfield of CONN_* class constants
Returns
never

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 107 of file LoadBalancerDisabled.php.

◆ reallyOpenConnection()

Wikimedia\Rdbms\LoadBalancerDisabled::reallyOpenConnection ( $i,
DatabaseDomain $domain,
array $lbInfo )
protected
Parameters
int$i
DatabaseDomain$domain
array$lbInfo
Returns
never

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 59 of file LoadBalancerDisabled.php.

◆ reuseConnection()

Wikimedia\Rdbms\LoadBalancerDisabled::reuseConnection ( IDatabase $conn)
Deprecated
since 1.39 noop
Parameters
IDatabase$conn

Reimplemented from Wikimedia\Rdbms\LoadBalancer.

Definition at line 111 of file LoadBalancerDisabled.php.


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