MediaWiki
master
|
Class for ensuring a consistent ordering of events as seen by the user, despite replication. More...
Public Member Functions | |
__construct (BagOStuff $store, array $client) | |
initLB (LoadBalancer $lb) | |
Initialise a LoadBalancer to give it appropriate chronology protection. More... | |
setEnabled ($enabled) | |
setWaitEnabled ($enabled) | |
shutdown () | |
Notify the ChronologyProtector that the LBFactory is done calling shutdownLB() for now. More... | |
shutdownLB (LoadBalancer $lb) | |
Notify the ChronologyProtector that the LoadBalancer is about to shut down. More... | |
Protected Member Functions | |
initPositions () | |
Load in previous master positions for the client. More... | |
Protected Attributes | |
array | $client |
Map of (ip: <IP>, agent: <user-agent>) More... | |
bool | $enabled = true |
Whether to no-op all method calls. More... | |
bool | $initialized = false |
Whether the client data was loaded. More... | |
string | $key |
Storage key name. More... | |
DBMasterPos[] | $shutdownPositions = [] |
Map of (DB master name => position) More... | |
DBMasterPos[] | $startupPositions = [] |
Map of (DB master name => position) More... | |
BagOStuff | $store |
bool | $wait = true |
Whether to check and wait on positions. More... | |
Class for ensuring a consistent ordering of events as seen by the user, despite replication.
Kind of like Hawking's [[Chronology Protection Agency]].
Definition at line 28 of file ChronologyProtector.php.
BagOStuff | $store | |
array | $client | Map of (ip: <IP>, agent: <user-agent>) |
Definition at line 53 of file ChronologyProtector.php.
References $client, $store, key, BagOStuff\makeGlobalKey(), and store.
ChronologyProtector::initLB | ( | LoadBalancer | $lb | ) |
Initialise a LoadBalancer to give it appropriate chronology protection.
If the stash has a previous master position recorded, this will try to make sure that the next query to a slave of that master will see changes up to that position by delaying execution. The delay may timeout and allow stale data if no non-lagged slaves are available.
LoadBalancer | $lb |
Definition at line 89 of file ChronologyProtector.php.
References LoadBalancer\getServerCount(), LoadBalancer\getServerName(), LoadBalancer\getWriterIndex(), initPositions(), LoadBalancer\parentInfo(), LoadBalancer\waitFor(), and wfDebugLog().
|
protected |
Load in previous master positions for the client.
Definition at line 192 of file ChronologyProtector.php.
References key, store, and wfDebugLog().
Referenced by initLB().
ChronologyProtector::setEnabled | ( | $enabled | ) |
bool | $enabled | Whether to no-op all method calls |
Definition at line 66 of file ChronologyProtector.php.
References $enabled.
Referenced by LBFactory\newChronologyProtector().
ChronologyProtector::setWaitEnabled | ( | $enabled | ) |
bool | $enabled | Whether to check and wait on positions |
Definition at line 74 of file ChronologyProtector.php.
References $enabled.
Referenced by LBFactory\newChronologyProtector().
ChronologyProtector::shutdown | ( | ) |
Notify the ChronologyProtector that the LBFactory is done calling shutdownLB() for now.
May commit chronology data to persistent storage.
Definition at line 140 of file ChronologyProtector.php.
References $key, $shutdownPositions, $store, as, false, key, store, IExpiringStore\TTL_MINUTE, use, wfDebugLog(), and BagOStuff\WRITE_SYNC.
Referenced by LBFactory\shutdownChronologyProtector().
ChronologyProtector::shutdownLB | ( | LoadBalancer | $lb | ) |
Notify the ChronologyProtector that the LoadBalancer is about to shut down.
Saves replication positions.
LoadBalancer | $lb |
Definition at line 113 of file ChronologyProtector.php.
References LoadBalancer\getAnyOpenConnection(), LoadBalancer\getServerCount(), LoadBalancer\getServerName(), LoadBalancer\getWriterIndex(), LoadBalancer\parentInfo(), and wfDebugLog().
Referenced by LBFactory\shutdownChronologyProtector().
|
protected |
Map of (ip: <IP>, agent: <user-agent>)
Definition at line 35 of file ChronologyProtector.php.
Referenced by __construct().
|
protected |
Whether to no-op all method calls.
Definition at line 37 of file ChronologyProtector.php.
Referenced by setEnabled(), and setWaitEnabled().
|
protected |
Whether the client data was loaded.
Definition at line 42 of file ChronologyProtector.php.
|
protected |
|
protected |
Map of (DB master name => position)
Definition at line 46 of file ChronologyProtector.php.
Referenced by shutdown().
|
protected |
Map of (DB master name => position)
Definition at line 44 of file ChronologyProtector.php.
|
protected |
Definition at line 30 of file ChronologyProtector.php.
Referenced by __construct(), and shutdown().
|
protected |
Whether to check and wait on positions.
Definition at line 39 of file ChronologyProtector.php.