API Documentation

Zend/Search/Lucene/LockManager.php

Show: inherited
Table of Contents

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 license@zend.com 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 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Search_Lucene_LockManager

Package: Zend\Search\Lucene

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

Constant  WRITE_LOCK_FILE = 'write.lock.file'

consts for name of file to show lock status

Constant  READ_LOCK_FILE = 'read.lock.file'
Constant  READ_LOCK_PROCESSING_LOCK_FILE = 'read-lock-processing.lock.file'
Constant  OPTIMIZATION_LOCK_FILE = 'optimization.lock.file'

Methods

methodprivate_startReadLockProcessing( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : \Zend_Search_Lucene_Storage_File
static

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

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
Returns
Type Description
\Zend_Search_Lucene_Storage_File
Throws
Exception Description
\Zend_Search_Lucene_Exception
methodprivate_stopReadLockProcessing( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : void
static

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.

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
methodpublicdeEscalateReadLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : void
static

De-escalate Read lock to shared level

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
methodpublicescalateReadLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : boolean
static

Escalate Read lock to exclusive level

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
Returns
Type Description
boolean
methodpublicobtainOptimizationLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : mixed
static

Obtain exclusive optimization lock on the index

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

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
Returns
Type Description
mixed
methodpublicobtainReadLock(  $lockDirectory ) : \Zend_Search_Lucene_Storage_File
static

Obtain shared read lock on the index

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

Parameters
Name Type Description
$lockDirectory
Returns
Type Description
\Zend_Search_Lucene_Storage_File
Throws
Exception Description
\Zend_Search_Lucene_Exception
methodpublicobtainWriteLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : \Zend_Search_Lucene_Storage_File
static

Obtain exclusive write lock on the index

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
Returns
Type Description
\Zend_Search_Lucene_Storage_File
Throws
Exception Description
\Zend_Search_Lucene_Exception
methodpublicreleaseOptimizationLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : void
static

Release exclusive optimization lock

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
methodpublicreleaseReadLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : void
static

Release shared read lock

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
methodpublicreleaseWriteLock( \Zend_Search_Lucene_Storage_Directory $lockDirectory ) : void
static

Release exclusive write lock

Parameters
Name Type Description
$lockDirectory \Zend_Search_Lucene_Storage_Directory
Documentation was generated by DocBlox 0.15.1.