MediaWiki
1.23.2
|
A multi-wiki, multi-master factory for Wikimedia and similar installations. More...
Public Member Functions | |
__construct ( $conf) | |
forEachLB ( $callback, $params=array()) | |
Execute a function for each tracked load balancer The callback is called with the load balancer as the first parameter, and $params passed as the subsequent parameters. More... | |
getDBNameAndPrefix ( $wiki=false) | |
Get the database name and prefix based on the wiki ID. More... | |
& | getExternalLB ( $cluster, $wiki=false) |
getMainLB ( $wiki=false) | |
getSectionForWiki ( $wiki=false) | |
makeServerArray ( $template, $loads, $groupLoads) | |
Make a server array as expected by LoadBalancer::__construct, using a template and load array. More... | |
newExternalLB ( $cluster, $wiki=false) | |
newLoadBalancer ( $template, $loads, $groupLoads) | |
Make a new load balancer object based on template and load array. More... | |
newMainLB ( $wiki=false) | |
reindexGroupLoads ( $groupLoads) | |
Take a group load array indexed by group then server, and reindex it by server then group. More... | |
shutdown () | |
Prepare all tracked load balancers for shutdown STUB. More... | |
Public Member Functions inherited from LBFactory | |
callMethod ( $loadBalancer, $methodName, $args) | |
Private helper for forEachLBCallMethod. More... | |
commitMasterChanges () | |
Commit changes on all master connections. More... | |
forEachLBCallMethod ( $methodName, $args=array()) | |
Call a method of each tracked load balancer. More... | |
hasMasterChanges () | |
Detemine if any master connection has pending changes. More... | |
rollbackMasterChanges () | |
Rollback changes on all master connections. More... | |
Protected Attributes | |
array | $conf |
Load balancer factory configuration *. More... | |
array | $externalLoads = array() |
A map of external storage cluster name to server load map *. More... | |
array | $externalTemplateOverrides |
A set of server info keys overriding serverTemplate for external storage. More... | |
LoadBalancer[] | $extLBs = array() |
array | $groupLoadsByDB = array() |
A 3-d map giving server load ratios by DB name *. More... | |
array | $groupLoadsBySection = array() |
A 3-d map giving server load ratios for each section and group *. More... | |
array | $hostsByName = array() |
A map of hostname to IP address *. More... | |
string | $lastSection |
string | $lastWiki |
LoadBalancer[] | $mainLBs = array() |
array | $masterTemplateOverrides |
An override array for all master servers *. More... | |
$readOnlyBySection = array() | |
array | $sectionLoads |
A 2-d map. More... | |
array | $sectionsByDB |
A map of database names to section names *. More... | |
array | $serverTemplate |
A server info associative array as documented for $wgDBservers. More... | |
array | $templateOverridesByCluster |
A 2-d map overriding the server info by external storage cluster *. More... | |
array | $templateOverridesByServer |
A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from LBFactory | |
static | destroyInstance () |
Shut down, close connections and destroy the cached instance. More... | |
static | disableBackend () |
Disables all access to the load balancer, will cause all database access to throw a DBAccessError. More... | |
static | getLBFactoryClass (array $config) |
Returns the LBFactory class to use and the load balancer configuration. More... | |
static | setInstance ( $instance) |
Set the instance to be the given object. More... | |
static & | singleton () |
Get an LBFactory instance. More... | |
Static Protected Attributes inherited from LBFactory | |
static | $instance |
A multi-wiki, multi-master factory for Wikimedia and similar installations.
Ignores the old configuration globals
Configuration: sectionsByDB A map of database names to section names.
sectionLoads A 2-d map. For each section, gives a map of server names to load ratios. For example: array( 'section1' => array( 'db1' => 100, 'db2' => 100 ) )
serverTemplate A server info associative array as documented for $wgDBservers. The host, hostName and load entries will be overridden.
groupLoadsBySection A 3-d map giving server load ratios for each section and group. For example: array( 'section1' => array( 'group1' => array( 'db1' => 100, 'db2' => 100 ) ) )
groupLoadsByDB A 3-d map giving server load ratios by DB name.
hostsByName A map of hostname to IP address.
externalLoads A map of external storage cluster name to server load map.
externalTemplateOverrides A set of server info keys overriding serverTemplate for external storage.
templateOverridesByServer A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis. Applies to both core and external storage.
templateOverridesByCluster A 2-d map overriding the server info by external storage cluster.
masterTemplateOverrides An override array for all master servers.
readOnlyBySection A map of section name to read-only message. Missing or false for read/write.
Definition at line 76 of file LBFactoryMulti.php.
LBFactoryMulti::__construct | ( | $conf | ) |
array | $conf |
MWException |
Reimplemented from LBFactory.
Definition at line 139 of file LBFactoryMulti.php.
References $conf, $section, array(), as, getSectionForWiki(), and global.
LBFactoryMulti::forEachLB | ( | $callback, | |
$params = array() |
|||
) |
Execute a function for each tracked load balancer The callback is called with the load balancer as the first parameter, and $params passed as the subsequent parameters.
callable | $callback | |
array | $params |
Reimplemented from LBFactory.
Definition at line 366 of file LBFactoryMulti.php.
LBFactoryMulti::getDBNameAndPrefix | ( | $wiki = false | ) |
Get the database name and prefix based on the wiki ID.
bool | string | $wiki |
Definition at line 349 of file LBFactoryMulti.php.
References $wgDBname, array(), global, and wfSplitWikiID().
Referenced by getSectionForWiki(), and newMainLB().
& LBFactoryMulti::getExternalLB | ( | $cluster, | |
$wiki = false |
|||
) |
string | $cluster | external storage cluster, or false for core |
bool | string | $wiki | Wiki ID, or false for the current wiki |
Reimplemented from LBFactory.
Definition at line 254 of file LBFactoryMulti.php.
References array(), and newExternalLB().
LBFactoryMulti::getMainLB | ( | $wiki = false | ) |
bool | string | $wiki |
Reimplemented from LBFactory.
Definition at line 216 of file LBFactoryMulti.php.
References $lb, $section, array(), getSectionForWiki(), and newMainLB().
LBFactoryMulti::getSectionForWiki | ( | $wiki = false | ) |
bool | string | $wiki |
Definition at line 173 of file LBFactoryMulti.php.
References $lastSection, $section, getDBNameAndPrefix(), and list.
Referenced by __construct(), getMainLB(), and newMainLB().
LBFactoryMulti::makeServerArray | ( | $template, | |
$loads, | |||
$groupLoads | |||
) |
Make a server array as expected by LoadBalancer::__construct, using a template and load array.
array | $template | |
array | $loads | |
array | $groupLoads |
Definition at line 291 of file LBFactoryMulti.php.
References array(), as, and reindexGroupLoads().
Referenced by newLoadBalancer().
LBFactoryMulti::newExternalLB | ( | $cluster, | |
$wiki = false |
|||
) |
string | $cluster | |
bool | string | $wiki |
MWException |
Reimplemented from LBFactory.
Definition at line 234 of file LBFactoryMulti.php.
References $serverTemplate, array(), and newLoadBalancer().
Referenced by getExternalLB().
LBFactoryMulti::newLoadBalancer | ( | $template, | |
$loads, | |||
$groupLoads | |||
) |
Make a new load balancer object based on template and load array.
array | $template | |
array | $loads | |
array | $groupLoads |
Definition at line 272 of file LBFactoryMulti.php.
References $lb, array(), global, and makeServerArray().
Referenced by newExternalLB(), and newMainLB().
LBFactoryMulti::newMainLB | ( | $wiki = false | ) |
bool | string | $wiki |
Reimplemented from LBFactory.
Definition at line 193 of file LBFactoryMulti.php.
References $section, array(), getDBNameAndPrefix(), getSectionForWiki(), list, and newLoadBalancer().
Referenced by getMainLB().
LBFactoryMulti::reindexGroupLoads | ( | $groupLoads | ) |
Take a group load array indexed by group then server, and reindex it by server then group.
array | $groupLoads |
Definition at line 333 of file LBFactoryMulti.php.
Referenced by makeServerArray().
LBFactoryMulti::shutdown | ( | ) |
Prepare all tracked load balancers for shutdown STUB.
Reimplemented from LBFactory.
Definition at line 375 of file LBFactoryMulti.php.
References $lb, as, and LBFactory\commitMasterChanges().
|
protected |
Load balancer factory configuration *.
Definition at line 125 of file LBFactoryMulti.php.
Referenced by __construct().
A map of external storage cluster name to server load map *.
Definition at line 100 of file LBFactoryMulti.php.
|
protected |
A set of server info keys overriding serverTemplate for external storage.
Definition at line 105 of file LBFactoryMulti.php.
|
protected |
Definition at line 129 of file LBFactoryMulti.php.
A 3-d map giving server load ratios by DB name *.
Definition at line 96 of file LBFactoryMulti.php.
A 3-d map giving server load ratios for each section and group *.
Definition at line 94 of file LBFactoryMulti.php.
A map of hostname to IP address *.
Definition at line 98 of file LBFactoryMulti.php.
|
protected |
|
protected |
Definition at line 131 of file LBFactoryMulti.php.
|
protected |
Definition at line 127 of file LBFactoryMulti.php.
|
protected |
An override array for all master servers *.
Definition at line 115 of file LBFactoryMulti.php.
|
protected |
Definition at line 121 of file LBFactoryMulti.php.
|
protected |
A 2-d map.
For each section, gives a map of server names to load ratios
Definition at line 84 of file LBFactoryMulti.php.
|
protected |
A map of database names to section names *.
Definition at line 79 of file LBFactoryMulti.php.
|
protected |
A server info associative array as documented for $wgDBservers.
The host, hostName and load entries will be overridden
Definition at line 90 of file LBFactoryMulti.php.
Referenced by newExternalLB().
|
protected |
A 2-d map overriding the server info by external storage cluster *.
Definition at line 113 of file LBFactoryMulti.php.
|
protected |
A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis.
Applies to both core and external storage
Definition at line 111 of file LBFactoryMulti.php.