MediaWiki REL1_27
LoadBalancerSingle Class Reference

Helper class for LBFactorySingle. More...

Inheritance diagram for LoadBalancerSingle:
Collaboration diagram for LoadBalancerSingle:

Public Member Functions

 __construct (array $params)
 
- Public Member Functions inherited from LoadBalancer
 allowLagged ( $mode=null)
 Disables/enables lag checks.
 
 clearLagTimeCache ()
 Clear the cache for slag lag delay times.
 
 closeAll ()
 Close all open connections.
 
 closeConnection ( $conn)
 Close a connection Using this function makes sure the LoadBalancer knows the connection is closed.
 
 commitAll ( $fname=__METHOD__)
 Commit transactions on all open connections.
 
 commitMasterChanges ( $fname=__METHOD__)
 Issue COMMIT only on master, only if queries were done on connection.
 
 forEachOpenConnection ( $callback, array $params=[])
 Call a function with each open connection object.
 
 getAnyOpenConnection ( $i)
 Get any open connection to a given server index, local or foreign Returns false if there is no connection open.
 
 getConnection ( $i, $groups=[], $wiki=false)
 Get a connection by index This is the main entry point for this class.
 
 getConnectionRef ( $db, $groups=[], $wiki=false)
 Get a database connection handle reference.
 
 getLaggedSlaveMode ( $wiki=false)
 
 getLagTimes ( $wiki=false)
 Get an estimate of replication lag (in seconds) for each server.
 
 getLazyConnectionRef ( $db, $groups=[], $wiki=false)
 Get a database connection handle reference without connecting yet.
 
 getMasterPos ()
 Get the current master position for chronology control purposes.
 
 getMaxLag ( $wiki=false)
 Get the hostname and lag time of the most-lagged slave.
 
 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.
 
 getReadOnlyReason ( $wiki=false)
 
 getServerCount ()
 Get the number of defined servers (not the number of open connections)
 
 getServerInfo ( $i)
 Return the server info structure for a given index, or false if the index is invalid.
 
 getServerName ( $i)
 Get the host name or IP address of the server with the specified index Prefer a readable name if available.
 
 getWriterIndex ()
 
 hasMasterChanges ()
 Determine if there are pending changes in a transaction by this thread.
 
 hasMasterConnection ()
 
 hasOrMadeRecentMasterChanges ( $age=null)
 Check if this load balancer object had any recent or still pending writes issued against it by this PHP thread.
 
 haveIndex ( $i)
 Returns true if the specified index is a valid server index.
 
 isNonZeroLoad ( $i)
 Returns true if the specified index is valid and has non-zero load.
 
 laggedSlaveUsed ()
 
 lastMasterChangeTimestamp ()
 Get the timestamp of the latest write query done by this thread.
 
 openConnection ( $i, $wiki=false)
 Open a connection to the server given by the specified index Index must be an actual index into the array.
 
 parentInfo ( $x=null)
 Get or set arbitrary data used by the parent object, usually an LBFactory.
 
 pendingMasterChangeCallers ()
 Get the list of callers that have pending master changes.
 
 pingAll ()
 
 reuseConnection ( $conn)
 Mark a foreign connection as being available for reuse under a different DB name or prefix.
 
 rollbackMasterChanges ( $fname=__METHOD__)
 Issue ROLLBACK only on master, only if queries were done on connection.
 
 safeGetLag (IDatabase $conn)
 Get the lag in seconds for a given connection, or zero if this load balancer does not have replication enabled.
 
 safeWaitForMasterPos (IDatabase $conn, $pos=false, $timeout=10)
 Wait for a slave DB to reach a specified master position.
 
 setServerInfo ( $i, array $serverInfo)
 Sets the server info structure for the given index.
 
 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.
 
 waitForAll ( $pos, $timeout=null)
 Set the master wait position and wait for ALL slaves to catch up to it.
 
 waitForOne ( $pos, $timeout=null)
 Set the master wait position and wait for a "generic" slave to catch up to it.
 
 waitTimeout ( $value=null)
 

Protected Member Functions

 reallyOpenConnection ( $server, $dbNameOverride=false)
 
- Protected Member Functions inherited from LoadBalancer
 doWait ( $index, $open=false, $timeout=null)
 Wait for a given slave to catch up to the master pos stored in $this.
 

Private Attributes

DatabaseBase $db
 

Additional Inherited Members

- Protected Attributes inherited from LoadBalancer
TransactionProfiler $trxProfiler
 

Detailed Description

Helper class for LBFactorySingle.

Definition at line 90 of file LBFactorySingle.php.

Constructor & Destructor Documentation

◆ __construct()

LoadBalancerSingle::__construct ( array  $params)
Parameters
array$params

Reimplemented from LoadBalancer.

Definition at line 97 of file LBFactorySingle.php.

References $params.

Member Function Documentation

◆ reallyOpenConnection()

LoadBalancerSingle::reallyOpenConnection (   $server,
  $dbNameOverride = false 
)
protected
Parameters
string$server
bool$dbNameOverride
Returns
DatabaseBase

Reimplemented from LoadBalancer.

Definition at line 124 of file LBFactorySingle.php.

References $db.

Member Data Documentation

◆ $db

DatabaseBase LoadBalancerSingle::$db
private

Definition at line 92 of file LBFactorySingle.php.

Referenced by reallyOpenConnection().


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