org.alfresco.repo.node.index
Class IndexTransactionTracker

java.lang.Object
  extended by org.alfresco.repo.node.index.AbstractReindexComponent
      extended by org.alfresco.repo.node.index.IndexTransactionTracker
All Implemented Interfaces:
IndexRecovery

public class IndexTransactionTracker
extends AbstractReindexComponent

Component to check and recover the indexes.


Nested Class Summary
static interface IndexTransactionTracker.IndexTransactionTrackerListener
          A callback that can be set to provide logging and other record keeping
 
Nested classes/interfaces inherited from class org.alfresco.repo.node.index.AbstractReindexComponent
AbstractReindexComponent.InIndex, AbstractReindexComponent.ReindexNodeCallback, AbstractReindexComponent.ReindexTerminatedException
 
Field Summary
 
Fields inherited from class org.alfresco.repo.node.index.AbstractReindexComponent
ftsIndexer, indexer, nodeDAO, nodeService, searcher, transactionService
 
Constructor Summary
IndexTransactionTracker()
          Set the defaults.
 
Method Summary
 java.lang.String getReindexStatus()
           
protected  long getStartingTxnCommitTime()
          Find a transaction time to start indexing from (inclusive).
protected  void reindexImpl()
          Perform the actual work.
protected  boolean requireTransaction()
          Determines if calls to AbstractReindexComponent.reindexImpl() should be wrapped in a transaction or not.
 void resetFromTxn(long txnId)
           
 void setDisableInTransactionIndexing(boolean disableInTransactionIndexing)
          Enable or disabled in-transaction indexing.
 void setListener(IndexTransactionTracker.IndexTransactionTrackerListener listener)
           
 void setMaxRecordSetSize(int maxRecordSetSize)
          Set the number of transactions to request per query.
 void setMaxTransactionsPerLuceneCommit(int maxTransactionsPerLuceneCommit)
          Set the number of transactions to process per Lucene write.
 void setMaxTxnDurationMinutes(long maxTxnDurationMinutes)
          Set the expected maximum duration of transaction supported.
 void setNodeIndexer(NodeIndexer nodeIndexer)
           
 void setReindexLagMs(long reindexLagMs)
          Transaction tracking should lag by the average commit time for a transaction.
 
Methods inherited from class org.alfresco.repo.node.index.AbstractReindexComponent
getIndexerWriteLock, isIgnorableStore, isShuttingDown, isTxnPresentInIndex, isTxnPresentInIndex, reindex, reindexTransaction, reindexTransaction, reindexTransactionAsynchronously, setAuthenticationComponent, setFtsIndexer, setIndexer, setNodeDAO, setNodeService, setSearcher, setShutdown, setStoreProtocolsToIgnore, setStoresToIgnore, setTenantService, setThreadPoolExecutor, setTransactionService, waitForAsynchronousReindexing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexTransactionTracker

public IndexTransactionTracker()
Set the defaults.

Method Detail

setListener

public void setListener(IndexTransactionTracker.IndexTransactionTrackerListener listener)

setNodeIndexer

public void setNodeIndexer(NodeIndexer nodeIndexer)

setMaxTxnDurationMinutes

public void setMaxTxnDurationMinutes(long maxTxnDurationMinutes)
Set the expected maximum duration of transaction supported. This value is used to adjust the look-back used to detect transactions that committed. Values must be greater than zero.

Parameters:
maxTxnDurationMinutes - the maximum length of time a transaction will take in minutes
Since:
1.4.5, 2.0.5, 2.1.1

setReindexLagMs

public void setReindexLagMs(long reindexLagMs)
Transaction tracking should lag by the average commit time for a transaction. This will minimize the number of holes in the transaction sequence. Values must be greater than zero.

Parameters:
reindexLagMs - the minimum age of a transaction to be considered by the index transaction tracking
Since:
1.4.5, 2.0.5, 2.1.1

setMaxRecordSetSize

public void setMaxRecordSetSize(int maxRecordSetSize)
Set the number of transactions to request per query.


setMaxTransactionsPerLuceneCommit

public void setMaxTransactionsPerLuceneCommit(int maxTransactionsPerLuceneCommit)
Set the number of transactions to process per Lucene write. Larger values generate less contention on the Lucene IndexInfo files.


setDisableInTransactionIndexing

public void setDisableInTransactionIndexing(boolean disableInTransactionIndexing)
Enable or disabled in-transaction indexing. Under certain circumstances, the system can run with only index tracking enabled - in-transaction indexing is not always required. The NodeIndexer is disabled when this component initialises.


requireTransaction

protected boolean requireTransaction()
Description copied from class: AbstractReindexComponent
Determines if calls to AbstractReindexComponent.reindexImpl() should be wrapped in a transaction or not. The default is true.

Overrides:
requireTransaction in class AbstractReindexComponent
Returns:
Returns false always. Transactions are handled internally.

resetFromTxn

public void resetFromTxn(long txnId)

reindexImpl

protected void reindexImpl()
Description copied from class: AbstractReindexComponent
Perform the actual work. This method will be called as the system user and within an existing transaction. This thread will only ever be accessed by a single thread per instance.

Specified by:
reindexImpl in class AbstractReindexComponent

getReindexStatus

public java.lang.String getReindexStatus()

getStartingTxnCommitTime

protected long getStartingTxnCommitTime()
Find a transaction time to start indexing from (inclusive). The last recorded transaction by ID is taken and the max transaction duration substracted from its commit time. A transaction is retrieved for this time and checked for indexing. If it is present, then that value is chosen. If not, a step back in time is taken again. This goes on until there are no more transactions or a transaction is found in the index.



Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.