API Documentation

Search/Lucene/LockManager.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
version
$Id: LockManager.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_Search_Lucene_LockManager

Description

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.

Zend_Search_Lucene_LockManager

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Search_Lucene
Constants
WRITE_LOCK_FILE
READ_LOCK_FILE
READ_LOCK_PROCESSING_LOCK_FILE
OPTIMIZATION_LOCK_FILE
Methods
obtainWriteLock
releaseWriteLock
_startReadLockProcessing
_stopReadLockProcessing
obtainReadLock
releaseReadLock
escalateReadLock
deEscalateReadLock
obtainOptimizationLock
releaseOptimizationLock

Description

This is an utility class which provides index locks processing functionality

Constants

WRITE_LOCK_FILE

 WRITE_LOCK_FILE = 'write.lock.file'

consts for name of file to show lock status

Details

value
write.lock.file

READ_LOCK_FILE

 READ_LOCK_FILE = 'read.lock.file'

Details

value
read.lock.file

READ_LOCK_PROCESSING_LOCK_FILE

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

Details

value
read-lock-processing.lock.file

OPTIMIZATION_LOCK_FILE

 OPTIMIZATION_LOCK_FILE = 'optimization.lock.file'

Details

value
optimization.lock.file

Methods

_startReadLockProcessing

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

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
private
final
false
static
true
throws

_stopReadLockProcessing

_stopReadLockProcessing( Zend_Search_Lucene_Storage_Directory $lockDirectory ) :

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.

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
private
final
false
static
true

deEscalateReadLock

deEscalateReadLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) :

De-escalate Read lock to shared level

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
public
final
false
static
true

escalateReadLock

escalateReadLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) : boolean

Escalate Read lock to exclusive level

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Output
boolean
Details
visibility
public
final
false
static
true

obtainOptimizationLock

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)

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Output
mixed
Details
visibility
public
final
false
static
true

obtainReadLock

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

Arguments
$lockDirectory
Details
visibility
public
final
false
static
true
throws

obtainWriteLock

obtainWriteLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) : Zend_Search_Lucene_Storage_File

Obtain exclusive write lock on the index

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
public
final
false
static
true
throws

releaseOptimizationLock

releaseOptimizationLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) :

Release exclusive optimization lock

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
public
final
false
static
true

releaseReadLock

releaseReadLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) :

Release shared read lock

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
public
final
false
static
true

releaseWriteLock

releaseWriteLock( Zend_Search_Lucene_Storage_Directory $lockDirectory ) :

Release exclusive write lock

Arguments
$lockDirectory
Zend_Search_Lucene_Storage_Directory
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.