com.bigdata.resources
Class StoreManager.ManagedJournal

java.lang.Object
  extended by com.bigdata.journal.AbstractJournal
      extended by com.bigdata.resources.StoreManager.ManagedJournal
All Implemented Interfaces:
IAtomicStore, IBTreeManager, IIndexManager, IIndexStore, IJournal, IAddressManager, IMRMW, IMROW, IRawStore, IStoreSerializer
Enclosing class:
StoreManager

public class StoreManager.ManagedJournal
extends AbstractJournal

The StoreManager.ManagedJournal provides the backing store used to absorb writes and retain history for the scale-out architecture.

Note: This implementation is designed to use a shared ConcurrencyManager across all open journal instances for a DataService.

Version:
$Id: StoreManager.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 
Fields inherited from class com.bigdata.journal.AbstractJournal
deleteOnClose, doubleSync, forceOnCommit, log, properties, ROOT_NAME2ADDR, tmpDir
 
Fields inherited from interface com.bigdata.rawstore.IAddressManager
NULL
 
Constructor Summary
protected StoreManager.ManagedJournal(Properties properties)
          Note: Each instance of the StoreManager.ManagedJournal reuses the SAME StoreManager.writeCache.
 
Method Summary
 long commitNow(long commitTime)
          Note: Exposed for the DataService which needs this for its 2-phase commit protocol.
 CommitRecordIndex getCommitRecordIndex(long addr)
          Exposed for StoreManger#getResourcesForTimestamp(long) which requires access to the CommitRecordIndex for the lastCommitTime on the historical journals.
 ExecutorService getExecutorService()
          Service for running arbitrary tasks in support of IResourceLocator.
 BigdataFileSystem getGlobalFileSystem()
          Return the global file system used to store block-structured files and their metadata and as a source and sink for map/reduce processing.
 SparseRowStore getGlobalRowStore()
          Return the global SparseRowStore used to store named property sets.
 AbstractLocalTransactionManager getLocalTransactionManager()
          Return the object providing the AbstractLocalTransactionManager for this journal.
 DefaultResourceLocator getResourceLocator()
          Return the default locator for resources that are logical index containers (relations and relation containers).
 IResourceLockService getResourceLockService()
          The service that may be used to acquire synchronous distributed locks without deadlock detection.
 TemporaryStore getTempStore()
          A factory for TemporaryStores.
 String toString()
           
protected  void validateIndexMetadata(String name, IndexMetadata metadata)
          Extended to set the IResourceMetadata to this journal if it is null since a remote caller can not have the correct metadata on hand when they formulate the request.
 
Methods inherited from class com.bigdata.journal.AbstractJournal
_close, _getName2Addr, abort, assertOpen, close, closeForWrites, commit, deleteResources, deserialize, deserialize, deserialize, destroy, discardCommitters, dropIndex, ensureMinFree, finalize, force, getBufferStrategy, getByteCount, getCommitRecord, getCommitRecord, getCommitRecordIndex, getCommitRecordStrictlyGreaterThan, getCounters, getFile, getIndex, getIndex, getIndex, getIndex, getLastCommitTime, getMaximumExtent, getMaxRecordSize, getName2Addr, getName2Addr, getOffset, getOffsetBits, getProperties, getProperty, getProperty, getProperty, getResourceMetadata, getRootAddr, getRootBlockView, getUUID, getWriteCache, isFullyBuffered, isOpen, isReadOnly, isStable, packAddr, read, registerIndex, registerIndex, registerIndex, registerIndex, rollback, serialize, setCommitter, setupCommitters, shutdown, shutdownNow, size, toAddr, toString, truncate, unpackAddr, write
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoreManager.ManagedJournal

protected StoreManager.ManagedJournal(Properties properties)
Note: Each instance of the StoreManager.ManagedJournal reuses the SAME StoreManager.writeCache. Therefore you MUST close out writes on the old journal BEFORE you may allocate a new journal.

Parameters:
properties -
See Also:
AbstractJournal.closeForWrites(long)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

commitNow

public long commitNow(long commitTime)
Note: Exposed for the DataService which needs this for its 2-phase commit protocol.

Overrides:
commitNow in class AbstractJournal
Parameters:
commitTime - The commit time either of a transaction or of an unisolated commit. Note that when mixing isolated and unisolated commits you MUST use the same ITimestampService for both purposes.
Returns:
The timestamp assigned to the commit record -or- 0L if there were no data to commit.

getCommitRecordIndex

public CommitRecordIndex getCommitRecordIndex(long addr)
Exposed for StoreManger#getResourcesForTimestamp(long) which requires access to the CommitRecordIndex for the lastCommitTime on the historical journals.

Note: This always returns a distinct index object. The code relies on this fact to avoid contention with the live CommitRecordIndex for the live journal.

Overrides:
getCommitRecordIndex in class AbstractJournal
Parameters:
addr - The root address of the index -or- 0L if the index has not been created yet.
Returns:
The CommitRecordIndex for that address or a new index if 0L was specified as the address.
See Also:
AbstractJournal._commitRecordIndex

getLocalTransactionManager

public AbstractLocalTransactionManager getLocalTransactionManager()
Description copied from class: AbstractJournal
Return the object providing the AbstractLocalTransactionManager for this journal.

Specified by:
getLocalTransactionManager in class AbstractJournal

getGlobalRowStore

public SparseRowStore getGlobalRowStore()
Description copied from interface: IIndexStore
Return the global SparseRowStore used to store named property sets.

See Also:
GlobalRowStoreSchema

getGlobalFileSystem

public BigdataFileSystem getGlobalFileSystem()
Description copied from interface: IIndexStore
Return the global file system used to store block-structured files and their metadata and as a source and sink for map/reduce processing.

See Also:
BigdataFileSystem

getResourceLocator

public DefaultResourceLocator getResourceLocator()
Description copied from interface: IIndexStore
Return the default locator for resources that are logical index containers (relations and relation containers).


getExecutorService

public ExecutorService getExecutorService()
Description copied from class: AbstractJournal
Service for running arbitrary tasks in support of IResourceLocator. There is no concurrency control associated with this service, but tasks run here may submit tasks to the ConcurrencyManager.

Specified by:
getExecutorService in interface IIndexStore
Specified by:
getExecutorService in class AbstractJournal

getResourceLockService

public IResourceLockService getResourceLockService()
Description copied from interface: IIndexStore
The service that may be used to acquire synchronous distributed locks without deadlock detection.


getTempStore

public TemporaryStore getTempStore()
Description copied from interface: IIndexStore
A factory for TemporaryStores. TemporaryStores are thread-safe and may be used by multiple processes at once. Old TemporaryStores are eventually retired by the factory and their storage is reclaimed once they are finalized (after they are no longer in use by any process). The decision to retire a TemporaryStore is either made implicitly, when it is no longer weakly reachable, or explicitly, when it has grown large enough that no new processes should begin using that TemporaryStore. In the latter case, the TemporaryStore will remain available to the process(es) using it and a new TemporaryStore will be allocated and made available to the caller.

It is important that processes do not hold a hard reference to a TemporaryStore beyond the end of the process as that will prevent the TemporaryStore from being finalized. Holding reference to an AbstractBTree created on a TemporaryStore is equivalent to holding a hard reference to the TemporaryStore itself since the AbstractBTree holds onto the backing IRawStore using a hard reference.

Returns:
A TemporaryStore.

validateIndexMetadata

protected void validateIndexMetadata(String name,
                                     IndexMetadata metadata)
Extended to set the IResourceMetadata to this journal if it is null since a remote caller can not have the correct metadata on hand when they formulate the request.

Overrides:
validateIndexMetadata in class AbstractJournal


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.