org.compass.core.lucene.engine.transaction
Class ReadCommittedTransaction
java.lang.Object
org.compass.core.lucene.engine.transaction.AbstractTransaction
org.compass.core.lucene.engine.transaction.ReadCommittedTransaction
- All Implemented Interfaces:
- LuceneSearchEngineTransaction
- Direct Known Subclasses:
- SerialableTransaction
public class ReadCommittedTransaction
- extends AbstractTransaction
A better implementation of the read committed transaction support. Uses the
TransIndex as the transactional index, which
means that it does not uses Lucene public API's, as well as Lucene segments
management (must use a
SearchEngineOptimizer
implementation) when using this transaction.
The transactional data is saved (by the TransIndex) in a RAM based engine,
and is used when performing find operations with the actual index using
Lucene "Multi" readers and searchers support. Deleted resources are save in
memory and filtered out from the search results using lucene filtering
mechanism. The commit operation adds the transactional data to the original
index, and deletes the marked resources for deletions.
By using the TransIndex, the transaction support two phase commits (see the
TransIndex documentation).
The transaction allows paralell searching, and single delete/create
threads/processess to happen (Using different transaction instances). Note
that even when performing dirty operations (delete/create), other
thread/processess can perform searchers.
There is no performance penalty when performing pure find operations, the
implementation is samrt enough and only creates the transactional supprot
when needed (i.e, when using dirty operations - create / delete).
- Author:
- kimchy
| Methods inherited from class org.compass.core.lucene.engine.transaction.AbstractTransaction |
begin, closeDelegateClosed, commit, configure, create, delete, find, getResourceMapping, internalSearch, isDirty, prepare, rollback |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
transIndexManager
protected ReadCommittedTransaction.TransIndexManager transIndexManager
ReadCommittedTransaction
public ReadCommittedTransaction()
doBegin
protected void doBegin()
throws SearchEngineException
- Specified by:
doBegin in class AbstractTransaction
- Throws:
SearchEngineException
doPrepare
protected void doPrepare()
throws SearchEngineException
- Specified by:
doPrepare in class AbstractTransaction
- Throws:
SearchEngineException
doCommit
protected void doCommit(boolean onePhase)
throws SearchEngineException
- Specified by:
doCommit in class AbstractTransaction
- Throws:
SearchEngineException
doRollback
protected void doRollback()
throws SearchEngineException
- Specified by:
doRollback in class AbstractTransaction
- Throws:
SearchEngineException
flush
public void flush()
throws SearchEngineException
- Description copied from interface:
LuceneSearchEngineTransaction
- Supported only in batch insert transacitons.
- Throws:
SearchEngineException
doCreate
protected void doCreate(InternalResource resource)
throws SearchEngineException
- Specified by:
doCreate in class AbstractTransaction
- Throws:
SearchEngineException
doDelete
protected void doDelete(ResourceKey resourceKey)
throws SearchEngineException
- Specified by:
doDelete in class AbstractTransaction
- Throws:
SearchEngineException
find
public Resource[] find(ResourceKey resourceKey)
throws SearchEngineException
- Throws:
SearchEngineException
doInternalSearch
protected SearchEngineInternalSearch doInternalSearch(String[] subIndexes,
String[] aliases)
throws SearchEngineException
- Specified by:
doInternalSearch in class AbstractTransaction
- Throws:
SearchEngineException
doFind
protected SearchEngineHits doFind(LuceneSearchEngineQuery query)
throws SearchEngineException
- Specified by:
doFind in class AbstractTransaction
- Throws:
SearchEngineException
Copyright (c) 2004-2006 The Compass Project.