Search/Lucene/LockManager.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Search_Lucene
- Version
- $Id: LockManager.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Search_Lucene_LockManager
This is an utility class which provides index locks processing functionality
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Methods


_startReadLockProcessing(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : \Zend_Search_Lucene_Storage_File
Obtain the exclusive "read escalation/de-escalation" lock
Required to protect the escalate/de-escalate read lock process on GFS (and potentially other) mounted filesystems.
Why we need this: While GFS supports cluster-wide locking via flock(), it's implementation isn't quite what it should be. The locking semantics that work consistently on a local filesystem tend to fail on GFS mounted filesystems. This appears to be a design defect in the implementation of GFS. How this manifests itself is that conditional promotion of a shared lock to exclusive will always fail, lock release requests are honored but not immediately processed (causing erratic failures of subsequent conditional requests) and the releasing of the exclusive lock before the shared lock is set when a lock is demoted (which can open a window of opportunity for another process to gain an exclusive lock when it shoudln't be allowed to).
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
\Zend_Search_Lucene_Storage_File |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


_stopReadLockProcessing(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : void
Release the exclusive "read escalation/de-escalation" lock
Required to protect the escalate/de-escalate read lock process on GFS (and potentially other) mounted filesystems.
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |


deEscalateReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : void
De-escalate Read lock to shared level
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |


escalateReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : boolean
Escalate Read lock to exclusive level
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
boolean |


obtainOptimizationLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : mixed
Obtain exclusive optimization lock on the index
Returns lock object on success and false otherwise (doesn't block execution)
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
mixed |


obtainReadLock( $lockDirectory) : \Zend_Search_Lucene_Storage_File
Obtain shared read lock on the index
It doesn't block other read or update processes, but prevent index from the premature cleaning-up
Name | Type | Description |
---|---|---|
$lockDirectory |
Type | Description |
---|---|
\Zend_Search_Lucene_Storage_File |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


obtainWriteLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : \Zend_Search_Lucene_Storage_File
Obtain exclusive write lock on the index
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |
Type | Description |
---|---|
\Zend_Search_Lucene_Storage_File |
Exception | Description |
---|---|
\Zend_Search_Lucene_Exception |


releaseOptimizationLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : void
Release exclusive optimization lock
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |


releaseReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : void
Release shared read lock
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |


releaseWriteLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : void
Release exclusive write lock
Name | Type | Description |
---|---|---|
$lockDirectory | \Zend_Search_Lucene_Storage_Directory |