public class JournalDelegate extends Object implements IJournal
IJournal delegation pattern.NULL| Constructor and Description |
|---|
JournalDelegate(AbstractJournal source) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abandon the current write set (synchronous).
|
ScheduledFuture<?> |
addScheduledTask(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
Adds a task which will run until canceled, until it throws an exception,
or until the service is shutdown.
|
long |
awaitHAReady(long timeout,
TimeUnit units)
Await the service being ready to partitipate in an HA quorum.
|
void |
close()
Close the store immediately.
|
long |
commit()
Atomic commit (synchronous).
|
void |
delete(long addr)
Delete the data (unisolated).
|
void |
deleteResources()
Deletes the backing file(s) (if any).
|
void |
destroy()
Closes the store immediately (if open) and deletes its persistent
resources.
|
void |
dropIndex(String name)
Drops the named index.
|
void |
force(boolean metadata)
Force the data to stable storage.
|
int |
getByteCount(long addr)
The length of the datum in bytes.
|
boolean |
getCollectPlatformStatistics()
true iff performance counters will be collected for the
platform on which the client is running. |
boolean |
getCollectQueueStatistics()
true iff statistics will be collected for work queues. |
ICommitRecord |
getCommitRecord(long timestamp)
Return the
ICommitRecord for the most recent committed state
whose commit timestamp is less than or equal to timestamp. |
CounterSet |
getCounters()
Return performance counters.
|
ExecutorService |
getExecutorService()
A
ExecutorService that may be used to parallelize operations. |
File |
getFile()
The backing file -or-
null if there is no backing file
for the store. |
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 an unisolated view of the global
SparseRowStore used to
store named property sets. |
SparseRowStore |
getGlobalRowStore(long timestamp)
Return a view of the global
SparseRowStore used to store named
property sets as of the specified timestamp. |
int |
getHttpdPort()
The port on which the optional httpd service will be run.
|
IIndex |
getIndex(String name)
Return the unisolated view of the named index (the mutable view of the
live index object).
|
IIndex |
getIndex(String name,
long timestamp)
Return a view of the named index as of the specified timestamp.
|
ICheckpointProtocol |
getIndexLocal(String name,
long commitTime)
Core implementation for access to historical index views.
|
InputStream |
getInputStream(long addr)
Return an input stream from which a previously written stream may be read
back.
|
long |
getLastCommitTime()
The database wide timestamp of the most recent commit on the store or 0L
iff there have been no commits.
|
ILocalTransactionManager |
getLocalTransactionManager()
Return the object providing the local transaction manager for this
journal.
|
long |
getOffset(long addr)
The offset on the store at which the datum is stored.
|
IPSOutputStream |
getOutputStream()
Return an output stream which can be used to write on the backing store.
|
long |
getPhysicalAddress(long addr)
Determine the unencoded physical address
|
Properties |
getProperties()
A copy of the properties used to initialize this journal.
|
Quorum<HAGlue,QuorumService<HAGlue>> |
getQuorum()
The
Quorum for this service -or- null if the service
is not running with a quorum. |
IResourceLocator |
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.
|
IResourceMetadata |
getResourceMetadata()
A description of this store in support of the scale-out architecture.
|
long |
getRootAddr(int index)
The last address stored in the specified root slot as of the last
committed state of the store.
|
IRootBlockView |
getRootBlockView()
Return a read-only view of the current root block.
|
TemporaryStore |
getTempStore()
A factory for
TemporaryStores. |
ICheckpointProtocol |
getUnisolatedIndex(String name)
Return the mutable view of the named persistence capable data structure
(aka the "live" or
ITx.UNISOLATED view). |
UUID |
getUUID()
|
Iterator<String> |
indexNameScan(String prefix,
long timestamp)
Iterator visits the names of all indices spanned by the given prefix.
|
boolean |
isDirty()
Return
true if the store has been modified since the last
IAtomicStore.commit() or IAtomicStore.abort(). |
boolean |
isFullyBuffered()
True iff the store is fully buffered (all reads are against memory).
|
boolean |
isGroupCommit()
Return true if the index manager supports group commit semantics.
|
boolean |
isHAJournal()
Convenience method created in BLZG-1370 to factor out bigdata-jini
artifact dependencies.
|
boolean |
isOpen()
true iff the store is open. |
boolean |
isReadOnly()
true iff the store does not allow writes. |
boolean |
isStable()
True iff backed by stable storage.
|
ByteBuffer |
read(long addr)
Read the data (unisolated).
|
ICheckpointProtocol |
register(String name,
IndexMetadata metadata)
Method creates and registers a named persistence capable data structure.
|
void |
registerIndex(IndexMetadata indexMetadata)
Register a named index.
|
IIndex |
registerIndex(String name,
BTree btree)
Register a named index.
|
IIndex |
registerIndex(String name,
IndexMetadata indexMetadata)
Register a named index.
|
void |
setCommitter(int index,
ICommitter committer)
Set a persistence capable data structure for callback during the commit
protocol.
|
void |
shutdown()
Shutdown the journal politely.
|
void |
shutdownNow()
Immediate shutdown.
|
long |
size()
The #of application data bytes written on the store (does not count any
headers or root blocks that may exist for the store).
|
long |
toAddr(int nbytes,
long offset)
Converts a byte count and offset into a long integer.
|
String |
toString(long addr)
A human readable representation of the address.
|
long |
write(ByteBuffer data)
Write the data (unisolated).
|
public JournalDelegate(AbstractJournal source)
public boolean isHAJournal()
IJournalisHAJournal in interface IJournalpublic Properties getProperties()
IJournalgetProperties in interface IJournalpublic void shutdown()
IJournalpublic void shutdownNow()
IJournalshutdownNow in interface IJournalpublic void abort()
IAtomicStoreabort in interface IAtomicStorepublic long commit()
IAtomicStore
Note: if the commit fails (by throwing any kind of exception) then you
MUST invoke IAtomicStore.abort() to abandon the current write set.
commit in interface IAtomicStoreICommitRecord -or- 0L if
there were no data to commit.public ICommitRecord getCommitRecord(long timestamp)
IAtomicStoreICommitRecord for the most recent committed state
whose commit timestamp is less than or equal to timestamp. This
is used by a transaction to locate the committed state that is
the basis for its operations.getCommitRecord in interface IAtomicStoretimestamp - The timestamp of interest.ICommitRecord for the most recent committed state
whose commit timestamp is less than or equal to timestamp
-or- null iff there are no ICommitRecords
that satisfy the probe.public long getRootAddr(int index)
IAtomicStoregetRootAddr in interface IAtomicStoreindex - The index of the root address to be retrieved.public IRootBlockView getRootBlockView()
IAtomicStoregetRootBlockView in interface IAtomicStorepublic void setCommitter(int index,
ICommitter committer)
IAtomicStoreNote: the committers must be reset after restart or whenever
setCommitter in interface IAtomicStoreindex - The slot in the root block where the address of the
ICommitter will be recorded.committer - The committer.public void close()
IRawStorepublic void delete(long addr)
IRawStoreAfter this operation subsequent reads on the address MAY fail and the caller MUST NOT depend on the ability to read at that address.
public void deleteResources()
IRawStoredeleteResources in interface IRawStorepublic void destroy()
IRawStoreIllegalStateException if the store
is already closed, but still deletes the backing resources.destroy in interface IIndexStoredestroy in interface IRawStoreIRawStore.deleteResources()public void force(boolean metadata)
IRawStorepublic CounterSet getCounters()
ICounterSetAccessgetCounters in interface ICounterSetAccesspublic File getFile()
IRawStorenull if there is no backing file
for the store.public IResourceMetadata getResourceMetadata()
IRawStoregetResourceMetadata in interface IRawStorepublic boolean isFullyBuffered()
IRawStoreNote: This does not guarantee that the OS will not swap the buffer onto disk.
isFullyBuffered in interface IRawStorepublic boolean isOpen()
IRawStoretrue iff the store is open.public boolean isReadOnly()
IRawStoretrue iff the store does not allow writes.isReadOnly in interface IRawStorepublic boolean isStable()
IRawStorepublic ByteBuffer read(long addr)
IRawStoreread in interface IRawStoreaddr - A long integer that encodes both the offset from which the
data will be read and the #of bytes to be read. See
IAddressManager.toAddr(int, long).public long size()
IRawStorepublic long write(ByteBuffer data)
IRawStorewrite in interface IRawStoredata - The data. The bytes from the current
Buffer.position() to the
Buffer.limit() will be written and the
Buffer.position() will be advanced to the
Buffer.limit() . The caller may subsequently
modify the contents of the buffer without changing the state
of the store (i.e., the data are copied into the store).IAddressManager.public int getByteCount(long addr)
IAddressManagerIRawStore.getByteCount in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public long getOffset(long addr)
IAddressManagergetOffset in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public long getPhysicalAddress(long addr)
IAddressManagergetPhysicalAddress in interface IAddressManageraddr - The encoded addresspublic long toAddr(int nbytes,
long offset)
IAddressManagertoAddr in interface IAddressManagernbytes - The byte count.offset - The byte offset.public String toString(long addr)
IAddressManagertoString in interface IAddressManageraddr - The opaque identifier that is the within store locator for
some datum.public IIndex getIndex(String name)
IBTreeManagergetIndex in interface IBTreeManagername - The name of the index.null iff there
is no index registered with that name.public IIndex registerIndex(String name, BTree btree)
IBTreeManagerregisterIndex in interface IBTreeManagername - The name that can be used to recover the index.btree - The btree.IBTreeManager.getIndex(String).IGISTManager.registerIndex(IndexMetadata),
IIndexManager.getIndex(String, long),
IGISTLocalManager.getIndexLocal(String, long)public IIndex registerIndex(String name, IndexMetadata indexMetadata)
IBTreeManager
This variant allows you to register an index under a name other than the
value returned by IndexMetadata.getName().
Note: This variant is generally by the IMetadataService when it
needs to register a index partition of some scale-out index on a
IDataService. In this case the name is the name of the
index partition while the value reported by
IndexMetadata.getName() is the name of the scale-out index. In
nearly all other cases you can use IGISTManager.registerIndex(IndexMetadata)
instead. The same method signature is also declared by
IDataService.registerIndex(String, IndexMetadata) in order to
support registration of index partitions.
Note: Due to the method signature, this method CAN NOT be used to create
and register persistence capable data structures other than an
IIndex (aka B+Tree).
registerIndex in interface IBTreeManagername - The name that can be used to recover the index.indexMetadata - The metadata describing the index.IBTreeManager.getIndex(String).IIndexManager.getIndex(String, long),
FIXME GIST Due to the method signature, this method CAN NOT be used
to create and register persistence capable data structures other
than an {@link IIndex} (aka B+Tree). It is difficult to reconcile
this method with other method signatures since this method is
designed for scale-out and relies on {@link IIndex}. However, only
the B+Tree is an {@link IIndex}. Therefore, this method signature
can not be readily reconciled with the {@link HTree}. The only
interface which the {@link BTree} and {@link HTree} share is the
{@link ICheckpointProtocol} interface, but that is a purely local
(not remote) interface and is therefore not suitable to scale-out.
Also, it is only in scale-out where the returned object can be a
different type than the simple {@link BTree} class, e.g., a
{@link FusedView} or even an {@link IClientIndex}.public void dropIndex(String name)
IGISTManagerNote: Whether or not and when index resources are reclaimed is dependent on the store. For example, an immortal store will retain all historical states for all indices. Likewise, a store that uses index partitions may be able to delete index segments immediately.
dropIndex in interface IGISTManagername - The name of the index to be dropped.public void registerIndex(IndexMetadata indexMetadata)
IGISTManager
Note: The name property MUST be set on the IndexMetadata
and the index will be registered under that name.
registerIndex in interface IGISTManagerindexMetadata - The metadata describing the index.IGISTLocalManager.getIndexLocal(String, long)public ExecutorService getExecutorService()
IIndexStoreExecutorService that may be used to parallelize operations.
This service is automatically used when materializing located resources.
While the service does not impose concurrency controls, tasks run on this
service may submit operations to a ConcurrencyManager.getExecutorService in interface IIndexStorepublic BigdataFileSystem getGlobalFileSystem()
IIndexStoregetGlobalFileSystem in interface IIndexStoreBigdataFileSystempublic SparseRowStore getGlobalRowStore()
IIndexStoreSparseRowStore used to
store named property sets.getGlobalRowStore in interface IIndexStoreGlobalRowStoreSchemapublic SparseRowStore getGlobalRowStore(long timestamp)
IIndexStoreSparseRowStore used to store named
property sets as of the specified timestamp.
The SparseRowStore only permits ITx.UNISOLATED writes, so
you MUST specify ITx.UNISOLATED as the timestamp if you intend to
write on the global row store!
You can request the most recent committed state of the global row store
by specifying ITx.READ_COMMITTED.
getGlobalRowStore in interface IIndexStoretimestamp - The timestamp of the view.null if no view
exists as of that timestamp.public IIndex getIndex(String name, long timestamp)
IIndexManagergetIndex in interface IIndexManagername - The index name.timestamp - A timestamp which represents either a possible commit time on
the store or a read-only transaction identifier.null iff there is no index registered
with that name for that timestamp.IGISTLocalManager.getIndexLocal(String, long)public long getLastCommitTime()
IIndexStoreThis method is useful if you plan to issue a series of read-consistent requests against the most current commit point of the database.
getLastCommitTime in interface IIndexStoreIRootBlockView.getLastCommitTime()public IResourceLocator getResourceLocator()
IIndexStoregetResourceLocator in interface IIndexStorepublic ILocalTransactionManager getLocalTransactionManager()
IJournalgetLocalTransactionManager in interface IJournalpublic IResourceLockService getResourceLockService()
IIndexStoregetResourceLockService in interface IIndexStorepublic TemporaryStore getTempStore()
IIndexStoreTemporaryStores. 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.
getTempStore in interface IIndexStoreTemporaryStore.public ScheduledFuture<?> addScheduledTask(Runnable task, long initialDelay, long delay, TimeUnit unit)
IIndexStoreaddScheduledTask in interface IIndexStoretask - The task.initialDelay - The initial delay.delay - The delay between invocations.unit - The units for the delay parameters.ScheduledFuture for that task.public boolean getCollectPlatformStatistics()
IIndexStoretrue iff performance counters will be collected for the
platform on which the client is running.getCollectPlatformStatistics in interface IIndexStorepublic boolean getCollectQueueStatistics()
IIndexStoretrue iff statistics will be collected for work queues.getCollectQueueStatistics in interface IIndexStorepublic int getHttpdPort()
IIndexStoregetHttpdPort in interface IIndexStorepublic Iterator<String> indexNameScan(String prefix, long timestamp)
IGISTManagerindexNameScan in interface IGISTManagerprefix - The prefix (optional). When given, this MUST include a
. if you want to restrict the scan to only those
indices in a given namespace. Otherwise you can find indices
in kb2 if you provide the prefix kb
where both kb and kb2 are namespaces since the indices spanned
by kb would include both kb.xyz and
kb2.xyx.timestamp - A timestamp which represents either a possible commit time on
the store or a read-only transaction identifier.public IPSOutputStream getOutputStream()
IStreamStoreIPSOutputStream.getOutputStream in interface IStreamStorepublic InputStream getInputStream(long addr)
IStreamStoregetInputStream in interface IStreamStoreaddr - The address at which the stream was written.public boolean isDirty()
IAtomicStoretrue if the store has been modified since the last
IAtomicStore.commit() or IAtomicStore.abort().isDirty in interface IAtomicStoreIAtomicStore.commit() or
IAtomicStore.abort().public boolean isGroupCommit()
IIndexManagerisGroupCommit in interface IIndexManager(NSS GROUP COMMIT)public ICheckpointProtocol register(String name, IndexMetadata metadata)
IGISTLocalManagerregister in interface IGISTLocalManagername - The name of the index.metadata - The metadata that describes the data structure to be created.IGISTManager.registerIndex(IndexMetadata),
Checkpoint.create(IRawStore, IndexMetadata)public ICheckpointProtocol getIndexLocal(String name, long commitTime)
IGISTLocalManagerNote: Transactions should pass in the timestamp against which they are reading rather than the transaction identifier (aka startTime). By providing the timestamp of the commit point, the transaction will hit the index cache on the journal. If the transaction passes the startTime instead, then all startTimes will be different and the cache will be defeated.
getIndexLocal in interface IGISTLocalManagerIIndexStore#getIndex(String, long),
Add
cache for access to historical index views on the Journal by name
and commitTime. ,
GIST
FIXME GIST : Reconcile with
{@link IResourceManager#getIndex(String, long)}. They are returning
types that do not overlap ({@link ICheckpointProtocol} and
{@link ILocalBTreeView}). This is blocking the support of GIST in
{@link AbstractTask}.public ICheckpointProtocol getUnisolatedIndex(String name)
IGISTLocalManagerITx.UNISOLATED view).
Note: IIndexManager#getIndex(String) delegates to this method and
then casts the result to an IIndex. This is the core
implementation to access an existing named index.
getUnisolatedIndex in interface IGISTLocalManagerIIndexManager#getIndex(String),
GIST public Quorum<HAGlue,QuorumService<HAGlue>> getQuorum()
IJournalQuorum for this service -or- null if the service
is not running with a quorum.public final long awaitHAReady(long timeout,
TimeUnit units)
throws InterruptedException,
TimeoutException,
AsynchronousQuorumCloseException
IJournal#setQuorumToken(long)
commitCounter:=0, then the root blocks from the leader have
been installed on the follower.awaitHAReady in interface IJournaltimeout - The timeout to await this condition.units - The units for that timeout.InterruptedExceptionTimeoutExceptionAsynchronousQuorumCloseExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.