This is an utility class which provides index locks processing functionality

category Zend
package Zend_Search_Lucene
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

De-escalate Read lock to shared level

deEscalateReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) 
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Escalate Read lock to exclusive level

escalateReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : boolean
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Returns

boolean

Obtain exclusive optimization lock on the index

obtainOptimizationLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : mixed
Static

Returns lock object on success and false otherwise (doesn't block execution)

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Returns

mixed

Obtain shared read lock on the index

obtainReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : \Zend_Search_Lucene_Storage_File
Static

It doesn't block other read or update processes, but prevent index from the premature cleaning-up

Parameters

$lockDirectory

Exceptions

\Zend_Search_Lucene_Exception

Returns

\Zend_Search_Lucene_Storage_File

Obtain exclusive write lock on the index

obtainWriteLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : \Zend_Search_Lucene_Storage_File
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Exceptions

\Zend_Search_Lucene_Exception

Returns

\Zend_Search_Lucene_Storage_File

Release exclusive optimization lock

releaseOptimizationLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) 
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Release shared read lock

releaseReadLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) 
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Release exclusive write lock

releaseWriteLock(\Zend_Search_Lucene_Storage_Directory $lockDirectory) 
Static

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Obtain the exclusive "read escalation/de-escalation" lock

_startReadLockProcessing(\Zend_Search_Lucene_Storage_Directory $lockDirectory) : \Zend_Search_Lucene_Storage_File
Static

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).

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

Exceptions

\Zend_Search_Lucene_Exception

Returns

\Zend_Search_Lucene_Storage_File

Release the exclusive "read escalation/de-escalation" lock

_stopReadLockProcessing(\Zend_Search_Lucene_Storage_Directory $lockDirectory) 
Static

Required to protect the escalate/de-escalate read lock process on GFS (and potentially other) mounted filesystems.

Parameters

$lockDirectory

\Zend_Search_Lucene_Storage_Directory

 Constants

 

OPTIMIZATION_LOCK_FILE

OPTIMIZATION_LOCK_FILE = 'optimization.lock.file' 
 

READ_LOCK_FILE

READ_LOCK_FILE = 'read.lock.file' 
 

READ_LOCK_PROCESSING_LOCK_FILE

READ_LOCK_PROCESSING_LOCK_FILE = 'read-lock-processing.lock.file' 
 

consts for name of file to show lock status

WRITE_LOCK_FILE = 'write.lock.file'