BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
DBLockManager Class Reference
Inheritance diagram for DBLockManager:
Collaboration diagram for DBLockManager:

Public Member Functions

 __construct (array $config)
 
 __destruct ()
 
- Public Member Functions inherited from LockManager
 __construct (array $config)
 
 lock (array $paths, $type=self::LOCK_EX, $timeout=0)
 
 lockByType (array $pathsByType, $timeout=0)
 
 unlock (array $paths, $type=self::LOCK_EX)
 
 unlockByType (array $pathsByType)
 

Protected Member Functions

 getLocksOnServer ($lockSrv, array $pathsByType)
 
 freeLocksOnServer ($lockSrv, array $pathsByType)
 
 isServerUp ($lockSrv)
 
 getConnection ($lockDb)
 
 initConnection ($lockDb, IDatabase $db)
 
 cacheCheckFailures ($lockDb)
 
 cacheRecordFailure ($lockDb)
 
 getMissKey ($lockDb)
 
- Protected Member Functions inherited from QuorumLockManager
 doLock (array $paths, $type)
 
 doUnlock (array $paths, $type)
 
 doLockByType (array $pathsByType)
 
 doUnlockByType (array $pathsByType)
 
 doLockingRequestBucket ($bucket, array $pathsByType)
 
 doUnlockingRequestBucket ($bucket, array $pathsByType)
 
 getBucketFromPath ($path)
 
 isServerUp ($lockSrv)
 
 getLocksOnServer ($lockSrv, array $pathsByType)
 
 freeLocksOnServer ($lockSrv, array $pathsByType)
 
 releaseAllLocks ()
 
- Protected Member Functions inherited from LockManager
 sha1Base36Absolute ($path)
 
 sha1Base16Absolute ($path)
 
 normalizePathsByType (array $pathsByType)
 
 doLockByType (array $pathsByType)
 
 doLock (array $paths, $type)
 
 doUnlockByType (array $pathsByType)
 
 doUnlock (array $paths, $type)
 

Protected Attributes

 $dbServers
 
 $statusCache
 
 $lockExpiry
 
 $safeDelay
 
 $session = 0
 
 $conns = []
 
- Protected Attributes inherited from QuorumLockManager
 $srvsByBucket = []
 
 $degradedBuckets = []
 
- Protected Attributes inherited from LockManager
 $lockTypeMap
 
 $locksHeld = []
 
 $domain
 
 $lockTTL
 

Additional Inherited Members

- Public Attributes inherited from LockManager
const LOCK_SH = 1
 
const LOCK_UW = 2
 
const LOCK_EX = 3
 

Detailed Description

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, all having the filelocks.sql tables (with row-level locking). A majority of peer DBs must agree for a lock to be acquired.

Caching is used to avoid hitting servers that are down.

Since
1.19

Constructor & Destructor Documentation

DBLockManager::__construct ( array  $config)

Construct a new instance from configuration.

Parameters
array$configParameters include:
  • dbServers : Associative array of DB names to server configuration. Configuration is an associative array that includes:
    • host : DB server name
    • dbname : DB name
    • type : DB type (mysql,postgres,...)
    • user : DB user
    • password : DB user password
    • tablePrefix : DB table prefix
    • flags : DB flags (see DatabaseBase)
  • dbsByBucket : Array of 1-16 consecutive integer keys, starting from 0, each having an odd-numbered list of DB names (peers) as values. Any DB named 'localDBMaster' will automatically use the DB master settings for this wiki (without the need for a dbServers entry). Only use 'localDBMaster' if the domain is a valid wiki ID.
  • lockExpiry : Lock timeout (seconds) for dropped connections. [optional] This tells the DB server how long to wait before assuming connection failure and releasing all the locks for a session.
DBLockManager::__destruct ( )

Make sure remaining locks get cleared for sanity

Member Function Documentation

DBLockManager::cacheCheckFailures (   $lockDb)
protected

Checks if the DB has not recently had connection/query errors. This just avoids wasting time on doomed connection attempts.

Parameters
string$lockDb
Returns
bool
DBLockManager::cacheRecordFailure (   $lockDb)
protected

Log a lock request failure to the cache

Parameters
string$lockDb
Returns
bool Success
DBLockManager::getConnection (   $lockDb)
protected

Get (or reuse) a connection to a lock DB

Parameters
string$lockDb
Returns
IDatabase
Exceptions
DBError
DBLockManager::getMissKey (   $lockDb)
protected

Get a cache key for recent query misses for a DB

Parameters
string$lockDb
Returns
string
DBLockManager::initConnection (   $lockDb,
IDatabase  $db 
)
protected

Do additional initialization for new lock DB connection

Parameters
string$lockDb
IDatabase$db
Exceptions
DBError
DBLockManager::isServerUp (   $lockSrv)
protected
See Also
QuorumLockManager::isServerUp()
Parameters
string$lockSrv
Returns
bool

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