|
MediaWiki REL1_39
|
Version of LockManager based on using named/row DB locks. More...


Public Member Functions | |
| __construct (array $config) | |
| Construct a new instance from configuration. | |
| __destruct () | |
| Make sure remaining locks get cleared. | |
Public Member Functions inherited from LockManager | |
| lock (array $paths, $type=self::LOCK_EX, $timeout=0) | |
| Lock the resources at the given abstract paths. | |
| lockByType (array $pathsByType, $timeout=0) | |
| Lock the resources at the given abstract paths. | |
| unlock (array $paths, $type=self::LOCK_EX) | |
| Unlock the resources at the given abstract paths. | |
| unlockByType (array $pathsByType) | |
| Unlock the resources at the given abstract paths. | |
Protected Member Functions | |||||||
| cacheCheckFailures ( $lockDb) | |||||||
| Checks if the DB has not recently had connection/query errors. | |||||||
| cacheRecordFailure ( $lockDb) | |||||||
| Log a lock request failure to the cache. | |||||||
| doGetLocksOnServer ( $lockSrv, array $paths, $type) | |||||||
| freeLocksOnServer ( $lockSrv, array $pathsByType) | |||||||
Get a connection to a lock server and release locks on $paths.Subclasses must effectively implement this or releaseAllLocks().
| |||||||
| getConnection ( $lockDb) | |||||||
| Get (or reuse) a connection to a lock DB. | |||||||
| getLocksOnServer ( $lockSrv, array $pathsByType) | |||||||
| getMissKey ( $lockDb) | |||||||
| Get a cache key for recent query misses for a DB. | |||||||
| initConnection ( $lockDb, IDatabase $db) | |||||||
| Do additional initialization for new lock DB connection. | |||||||
| isServerUp ( $lockSrv) | |||||||
Protected Member Functions inherited from QuorumLockManager | |||||||
| collectPledgeQuorum ( $bucket, callable $callback) | |||||||
| Attempt to acquire pledges with the peers for a bucket. | |||||||
| doLock (array $paths, $type) | |||||||
| Lock resources with the given keys and lock type. | |||||||
| doLockByType (array $pathsByType) | |||||||
| doLockingRequestBucket ( $bucket, array $pathsByType) | |||||||
| Attempt to acquire locks with the peers for a bucket. | |||||||
| doUnlock (array $paths, $type) | |||||||
| Unlock resources with the given keys and lock type. | |||||||
| doUnlockByType (array $pathsByType) | |||||||
| doUnlockingRequestBucket ( $bucket, array $pathsByType) | |||||||
| Attempt to release locks with the peers for a bucket. | |||||||
| getBucketFromPath ( $path) | |||||||
| Get the bucket for resource path. | |||||||
| releaseAllLocks () | |||||||
| Release all locks that this session is holding. | |||||||
| releasePledges ( $bucket, callable $callback) | |||||||
| Attempt to release pledges with the peers for a bucket. | |||||||
Protected Member Functions inherited from LockManager | |||||||
| normalizePathsByType (array $pathsByType) | |||||||
| Normalize the $paths array by converting LOCK_UW locks into the appropriate type and removing any duplicated paths for each lock type. | |||||||
| sha1Base16Absolute ( $path) | |||||||
| Get the base 16 SHA-1 of a string, padded to 31 digits. | |||||||
| sha1Base36Absolute ( $path) | |||||||
| Get the base 36 SHA-1 of a string, padded to 31 digits. | |||||||
Protected Attributes | |
| IDatabase[] | $conns = [] |
| Map Database connections (DB name => Database) | |
| array[] IDatabase[] | $dbServers |
| Map of (DB names => server config or IDatabase) | |
| $lockExpiry | |
| $safeDelay | |
| BagOStuff | $statusCache |
Protected Attributes inherited from QuorumLockManager | |
| array | $degradedBuckets = [] |
| Map of degraded buckets. | |
| array | $srvsByBucket = [] |
| Map of bucket indexes to peer server lists. | |
Protected Attributes inherited from LockManager | |
| $domain | |
| array | $locksHeld = [] |
| Map of (resource path => lock type => count) | |
| $lockTTL | |
| array | $lockTypeMap |
| Mapping of lock types to the type actually used. | |
| LoggerInterface | $logger |
| string | $session |
| Random 32-char hex number. | |
| const | CLI_LOCK_TTL = 3600 |
| Default lock TTL in CLI mode. | |
| const | MAX_LOCK_TTL = 2 * 3600 |
| Max expected lock expiry in any context. | |
| const | MIN_GUESSED_LOCK_TTL = 5 * 60 |
| The minimum lock TTL if it is guessed from max_execution_time rather than configured. | |
| const | MIN_LOCK_TTL = 5 |
| Minimum lock TTL. | |
Additional Inherited Members | |
Public Attributes inherited from LockManager | |
| const | LOCK_EX = 3 |
| const | LOCK_SH = 1 |
| Lock types; stronger locks have higher values. | |
| const | LOCK_UW = 2 |
Version of LockManager based on using named/row DB locks.
This is meant for multi-wiki systems that may share files.
All lock requests for a resource, identified by a hash string, will map to one bucket. Each bucket maps to one or several peer DBs, each on their own server. A majority of peer DBs must agree for a lock to be acquired.
Caching is used to avoid hitting servers that are down.
Definition at line 43 of file DBLockManager.php.
| DBLockManager::__construct | ( | array | $config | ) |
Construct a new instance from configuration.
| array | $config | Parameters include:
|
Reimplemented from LockManager.
Reimplemented in MySqlLockManager.
Definition at line 76 of file DBLockManager.php.
References $lockExpiry.
| DBLockManager::__destruct | ( | ) |
Make sure remaining locks get cleared.
Definition at line 239 of file DBLockManager.php.
References QuorumLockManager\releaseAllLocks().
|
protected |
Checks if the DB has not recently had connection/query errors.
This just avoids wasting time on doomed connection attempts.
| string | $lockDb |
Definition at line 208 of file DBLockManager.php.
References getMissKey().
Referenced by isServerUp().
|
protected |
Log a lock request failure to the cache.
| string | $lockDb |
Definition at line 220 of file DBLockManager.php.
References getMissKey().
Referenced by isServerUp().
|
abstractprotected |
Reimplemented in MySqlLockManager, and PostgreSqlLockManager.
Referenced by getLocksOnServer().
|
protected |
Get a connection to a lock server and release locks on $paths.Subclasses must effectively implement this or releaseAllLocks().
| string | $lockSrv | |
| array | $pathsByType | Map of LockManager::LOCK_* constants to lists of paths |
Reimplemented from QuorumLockManager.
Definition at line 125 of file DBLockManager.php.
|
protected |
Get (or reuse) a connection to a lock DB.
| string | $lockDb |
| DBError | |
| UnexpectedValueException |
Definition at line 157 of file DBLockManager.php.
References $lockExpiry, and initConnection().
Referenced by MySqlLockManager\doGetLocksOnServer(), PostgreSqlLockManager\doGetLocksOnServer(), and isServerUp().
|
protected |
| string | $lockSrv | |
| array | $pathsByType |
Reimplemented from QuorumLockManager.
Definition at line 110 of file DBLockManager.php.
References $type, and doGetLocksOnServer().
|
protected |
Get a cache key for recent query misses for a DB.
| string | $lockDb |
Definition at line 232 of file DBLockManager.php.
Referenced by cacheCheckFailures(), and cacheRecordFailure().
|
protected |
Do additional initialization for new lock DB connection.
| string | $lockDb | |
| IDatabase | $db |
| DBError |
Reimplemented in MySqlLockManager.
Definition at line 198 of file DBLockManager.php.
Referenced by getConnection().
|
protected |
| string | $lockSrv |
Reimplemented from QuorumLockManager.
Definition at line 134 of file DBLockManager.php.
References cacheCheckFailures(), cacheRecordFailure(), and getConnection().
|
protected |
Map Database connections (DB name => Database)
Definition at line 52 of file DBLockManager.php.
|
protected |
Map of (DB names => server config or IDatabase)
Definition at line 45 of file DBLockManager.php.
|
protected |
Definition at line 49 of file DBLockManager.php.
Referenced by __construct(), and getConnection().
|
protected |
Definition at line 50 of file DBLockManager.php.
|
protected |
Definition at line 47 of file DBLockManager.php.