|
MediaWiki
master
|
A multi-wiki, multi-master factory for Wikimedia and similar installations. More...


Public Member Functions | |
| __construct (array $conf) | |
| forEachLB ($callback, array $params=[]) | |
| 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... | |
| & | getExternalLB ($cluster, $wiki=false) |
| getMainLB ($wiki=false) | |
| newMainLB ($wiki=false) | |
| shutdown ($flags=0) | |
Public Member Functions inherited from LBFactory | |
| __construct (array $conf) | |
| Construct a factory based on a configuration array (typically from $wgLBFactoryConf) More... | |
| closeAll () | |
| Close all open database connections on all open load balancers. More... | |
| commitAll ($fname=__METHOD__, array $options=[]) | |
| Commit on all connections. More... | |
| commitMasterChanges ($fname=__METHOD__, array $options=[]) | |
| Commit changes on all master connections. More... | |
| destroy () | |
| Disables all load balancers. More... | |
| disableChronologyProtection () | |
| Disable the ChronologyProtector for all load balancers. More... | |
| forEachLB ($callback, array $params=[]) | |
| 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... | |
| & | getExternalLB ($cluster, $wiki=false) |
| Get a cached (tracked) load balancer for external storage. More... | |
| getMainLB ($wiki=false) | |
| Get a cached (tracked) load balancer object. More... | |
| hasMasterChanges () | |
| Determine if any master connection has pending changes. More... | |
| hasOrMadeRecentMasterChanges () | |
| Determine if any master connection has pending/written changes from this request. More... | |
| laggedSlaveUsed () | |
| Detemine if any lagged slave connection was used. More... | |
| newMainLB ($wiki=false) | |
| Create a new load balancer object. More... | |
| rollbackMasterChanges ($fname=__METHOD__) | |
| Rollback changes on all master connections. More... | |
| shutdown ($flags=0) | |
| Prepare all tracked load balancers for shutdown. More... | |
| waitForReplication (array $opts=[]) | |
| Waits for the slave DBs to catch up to the current master position. More... | |
Protected Member Functions | |
| newExternalLB ($cluster, $wiki=false) | |
Protected Member Functions inherited from LBFactory | |
| newChronologyProtector () | |
| newExternalLB ($cluster, $wiki=false) | |
| Create a new load balancer for external storage. More... | |
| shutdownChronologyProtector (ChronologyProtector $cp) | |
Private Member Functions | |
| getDBNameAndPrefix ($wiki=false) | |
| Get the database name and prefix based on the wiki ID. More... | |
| getSectionForWiki ($wiki=false) | |
| makeServerArray ($template, $loads, $groupLoads) | |
| Make a server array as expected by LoadBalancer::__construct, using a template and load array. More... | |
| newLoadBalancer ($template, $loads, $groupLoads, $readOnlyReason) | |
| Make a new load balancer object based on template and load array. More... | |
| reindexGroupLoads ($groupLoads) | |
| Take a group load array indexed by group then server, and reindex it by server then group. More... | |
Private Attributes | |
| array | $conf |
| Load balancer factory configuration. More... | |
| array | $externalLoads = [] |
| 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 | $groupLoadsByDB = [] |
| A 3-d map giving server load ratios by DB name. More... | |
| array | $groupLoadsBySection = [] |
| A 3-d map giving server load ratios for each section and group. More... | |
| array | $hostsByName = [] |
| A map of hostname to IP address. More... | |
| string | $lastSection |
| string | $lastWiki |
| string | $loadMonitorClass |
| LoadBalancer[] | $mainLBs = [] |
| array | $masterTemplateOverrides |
| An override array for all master servers. More... | |
| array bool | $readOnlyBySection = [] |
| A map of section name to read-only message. More... | |
| 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 | $templateOverridesBySection |
| A 2-d map overriding the server info by section. 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 | singleton () |
| Get an LBFactory instance. More... | |
Public Attributes inherited from LBFactory | |
| const | SHUTDOWN_NO_CHRONPROT = 1 |
Protected Attributes inherited from LBFactory | |
| ChronologyProtector | $chronProt |
| LoggerInterface | $logger |
| string bool | $readOnlyReason = false |
| Reason all LBs are read-only or false if not. More... | |
| TransactionProfiler | $trxProfiler |
A multi-wiki, multi-master factory for Wikimedia and similar installations.
Ignores the old configuration globals.
Template override precedence (highest => lowest):
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. templateOverridesBySection A 2-d map overriding the server info by section. templateOverridesByCluster A 2-d map overriding the server info by external storage cluster.
masterTemplateOverrides An override array for all master servers.
loadMonitorClass Name of the LoadMonitor class to always use.
readOnlyBySection A map of section name to read-only message. Missing or false for read/write.
Definition at line 86 of file LBFactoryMulti.php.
| LBFactoryMulti::__construct | ( | array | $conf | ) |
| LBFactoryMulti::forEachLB | ( | $callback, | |
| array | $params = [] |
||
| ) |
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 |
Definition at line 409 of file LBFactoryMulti.php.
|
private |
Get the database name and prefix based on the wiki ID.
| bool | string | $wiki |
Definition at line 392 of file LBFactoryMulti.php.
References $wgDBname, $wgDBprefix, 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 |
Definition at line 296 of file LBFactoryMulti.php.
References newExternalLB().
| LBFactoryMulti::getMainLB | ( | $wiki = false | ) |
| bool | string | $wiki |
Definition at line 253 of file LBFactoryMulti.php.
References $section, getSectionForWiki(), and newMainLB().
|
private |
| bool | string | $wiki |
Definition at line 197 of file LBFactoryMulti.php.
References $lastSection, $section, getDBNameAndPrefix(), and list.
Referenced by getMainLB(), and newMainLB().
|
private |
Make a server array as expected by LoadBalancer::__construct, using a template and load array.
| array | $template | |
| array | $loads | |
| array | $groupLoads |
Definition at line 332 of file LBFactoryMulti.php.
References $template, as, and reindexGroupLoads().
Referenced by newLoadBalancer().
|
protected |
| string | $cluster | |
| bool | string | $wiki |
| MWException |
Definition at line 271 of file LBFactoryMulti.php.
References $serverTemplate, $template, and newLoadBalancer().
Referenced by getExternalLB().
|
private |
Make a new load balancer object based on template and load array.
| array | $template | |
| array | $loads | |
| array | $groupLoads | |
| string | bool | $readOnlyReason |
Definition at line 315 of file LBFactoryMulti.php.
References LBFactory\$readOnlyReason, $template, and makeServerArray().
Referenced by newExternalLB(), and newMainLB().
| LBFactoryMulti::newMainLB | ( | $wiki = false | ) |
| bool | string | $wiki |
Definition at line 217 of file LBFactoryMulti.php.
References LBFactory\$readOnlyReason, $section, $serverTemplate, $template, getDBNameAndPrefix(), getSectionForWiki(), list, and newLoadBalancer().
Referenced by getMainLB().
|
private |
Take a group load array indexed by group then server, and reindex it by server then group.
| array | $groupLoads |
Definition at line 376 of file LBFactoryMulti.php.
References as.
Referenced by makeServerArray().
| LBFactoryMulti::shutdown | ( | $flags = 0 | ) |
Definition at line 418 of file LBFactoryMulti.php.
References $flags, LBFactory\commitMasterChanges(), and LBFactory\shutdownChronologyProtector().
|
private |
Load balancer factory configuration.
Definition at line 148 of file LBFactoryMulti.php.
Referenced by __construct().
|
private |
A map of external storage cluster name to server load map.
Definition at line 115 of file LBFactoryMulti.php.
|
private |
A set of server info keys overriding serverTemplate for external storage.
Definition at line 121 of file LBFactoryMulti.php.
|
private |
Definition at line 154 of file LBFactoryMulti.php.
|
private |
A 3-d map giving server load ratios by DB name.
Definition at line 109 of file LBFactoryMulti.php.
|
private |
A 3-d map giving server load ratios for each section and group.
Definition at line 106 of file LBFactoryMulti.php.
|
private |
A map of hostname to IP address.
Definition at line 112 of file LBFactoryMulti.php.
|
private |
Definition at line 163 of file LBFactoryMulti.php.
Referenced by getSectionForWiki().
|
private |
Definition at line 160 of file LBFactoryMulti.php.
|
private |
Definition at line 157 of file LBFactoryMulti.php.
|
private |
Definition at line 151 of file LBFactoryMulti.php.
|
private |
An override array for all master servers.
Definition at line 137 of file LBFactoryMulti.php.
|
private |
A map of section name to read-only message.
Missing or false for read/write
Definition at line 143 of file LBFactoryMulti.php.
|
private |
A 2-d map.
For each section, gives a map of server names to load ratios
Definition at line 94 of file LBFactoryMulti.php.
|
private |
A map of database names to section names.
Definition at line 88 of file LBFactoryMulti.php.
|
private |
A server info associative array as documented for $wgDBservers.
The host, hostName and load entries will be overridden
Definition at line 101 of file LBFactoryMulti.php.
Referenced by newExternalLB(), and newMainLB().
|
private |
A 2-d map overriding the server info by external storage cluster.
Definition at line 134 of file LBFactoryMulti.php.
|
private |
A 2-d map overriding the server info by section.
Definition at line 131 of file LBFactoryMulti.php.
|
private |
A 2-d map overriding serverTemplate and externalTemplateOverrides on a server-by-server basis.
Applies to both core and external storage
Definition at line 128 of file LBFactoryMulti.php.