public interface IResourceManager extends IServiceShutdown
BTree
s, or an
IndexSegmentStore
containing a single IndexSegment
.
Note: For historical reasons there are two implementations of this interface.
The Journal
uses an implementation that does not support
overflow()
since the managed "journal" is always the actual
Journal
reference. The ResourceManager
supports
overflow()
and decouples the management of the journal and index
segment resources and the concurrency control from the journal itself.
IServiceShutdown.Options
Modifier and Type | Method and Description |
---|---|
void |
deleteResources()
Deletes all resources.
|
CounterSet |
getCounters()
Statistics about the
IResourceManager . |
File |
getDataDir()
The directory for managed resources.
|
DataService |
getDataService()
The local
DataService whose resources are being managed. |
UUID |
getDataServiceUUID()
Return the
UUID of the IDataService whose resources are
being managed. |
IBigdataFederation<?> |
getFederation()
The federation whose resources are being managed.
|
ILocalBTreeView |
getIndex(String name,
long timestamp)
Return a view of the named index as of the specified timestamp.
|
BTreeCounters |
getIndexCounters(String name)
Return the
BTreeCounters for the named index. |
StaleLocatorReason |
getIndexPartitionGone(String name)
Return non-
null iff name is the name of an
ITx.UNISOLATED index partition that was located on the associated
DataService but which is now gone. |
File |
getIndexSegmentFile(IndexMetadata indexMetadata)
Return the file on which a new
IndexSegment should be written. |
AbstractBTree[] |
getIndexSources(String name,
long timestamp)
Return the ordered
AbstractBTree sources for an index or a view
of an index partition. |
AbstractBTree[] |
getIndexSources(String name,
long timestamp,
BTree btree)
Examine the partition metadata (if any) for the
BTree . |
AbstractJournal |
getJournal(long timestamp)
Return the reference to the journal which has the most current data for
the given timestamp.
|
AbstractJournal |
getLiveJournal()
The journal on which writes are made.
|
File |
getTmpDir()
The directory for temporary files.
|
boolean |
isOverflowEnabled()
true if overflow processing is enabled and
false if overflow processing was disabled as a
configuration option, in which case overflow processing can
not be performed. |
IRawStore |
openStore(UUID uuid)
Opens an
IRawStore . |
Future<Object> |
overflow()
Overflow processing creates a new journal, migrates the named indices on
the current journal the new journal, and continues operations on the new
journal.
|
boolean |
shouldOverflow()
Return
true if the pre-conditions for overflow of the
live journal have been met. |
isOpen, shutdown, shutdownNow
File getTmpDir()
File getDataDir()
AbstractJournal getLiveJournal()
overflow()
.AbstractJournal getJournal(long timestamp)
timestamp
- A transaction identifier, ITx.UNISOLATED
for the
unisolated index view, ITx.READ_COMMITTED
, or
timestamp
for a historical view no later than
the specified timestamp.null
if no journal has data for that timestamp,
including when a historical journal with data for that timestamp
has been deleted.IRawStore openStore(UUID uuid)
IRawStore
.uuid
- The UUID identifying that store file.IRawStore
.RuntimeException
- if something goes wrong.AbstractBTree[] getIndexSources(String name, long timestamp)
AbstractBTree
sources for an index or a view
of an index partition. The AbstractBTree
s are ordered from the
most recent to the oldest and together comprise a coherent view of an
index partition.
Note: Index sources loaded from a historical timestamp (vs the live unisolated index view) will always be read-only.
name
- The name of the index.timestamp
- A transaction identifier, ITx.UNISOLATED
for the
unisolated index view, ITx.READ_COMMITTED
, or
timestamp
for a historical view no later than
the specified timestamp.null
if the
index was not defined as of the timestamp.FusedView
AbstractBTree[] getIndexSources(String name, long timestamp, BTree btree)
BTree
. If the
BTree
is part of an index partition, then return all of the
sources for a view of that index partition (the BTree
will be the
first element in the array and, if there are no more sources for the
index partition, then it will also be the sole element of the array).
Otherwise return an array consisting of a single element, which is the
BTree
.ILocalBTreeView getIndex(String name, long timestamp)
Note: An index view loaded from a historical timestamp (vs the live unisolated index view) will always be read-only.
name
- The index name.timestamp
- A transaction identifier, ITx.UNISOLATED
for the
unisolated index view, ITx.READ_COMMITTED
, or
timestamp
for a historical view no later than the
specified timestamp.null
iff there is no index registered
with that name for that timestamp, including if the
timestamp is a transaction identifier and the transaction is
unknown or not active.IllegalArgumentException
- if name is null
StaleLocatorException
- if the named index does not exist at the time the
operation is executed and the IResourceManager
has
information which indicates that the index partition has
been split, joined or moved.FIXME GIST - this only supports {@link ILocalBTreeView}. We need to
also support {@link HTree}, etc. See
{@link IBTreeManager#getIndexLocal(String, long)} which is the
corresponding method for local stores.
,
GIST StaleLocatorReason getIndexPartitionGone(String name)
null
iff name is the name of an
ITx.UNISOLATED
index partition that was located on the associated
DataService
but which is now gone.name
- The name of an index partition.null
iff
the index partition is not known to be gone.CounterSet getCounters()
IResourceManager
.boolean shouldOverflow()
true
if the pre-conditions for overflow of the
live journal
have been met. In general, this
means that the live journal is within some threshold of the configured
Options.MAXIMUM_EXTENT
.true
if overflow processing should occur.boolean isOverflowEnabled()
true
if overflow processing is enabled and
false
if overflow processing was disabled as a
configuration option, in which case overflow processing can
not be performed.Future<Object> overflow()
Note: When this method returns true
journal references
MUST NOT be presumed to survive this method. In particular, the old
journal MAY be closed out by this method and marked as read-only
henceforth.
Note: The caller MUST ensure that they have an exclusive lock on the
WriteExecutorService
such that no task is running with write
access to the live journal
.
Note: The implementation MUST NOT write on the old journal - those writes
will not be made restart safe by the WriteExecutorService
- but
it MAY write on the new journal.
Future
for the task handling post-processing of the
old journal.void deleteResources()
IllegalStateException
- if the IResourceManager
is open.File getIndexSegmentFile(IndexMetadata indexMetadata)
IndexSegment
should be written.
The file will exist but will have zero length.indexMetadata
- The index metadata.UUID getDataServiceUUID()
UUID
of the IDataService
whose resources are
being managed.DataService getDataService()
DataService
whose resources are being managed.UnsupportedOperationException
- if the IResourceManager
is not part of an
IBigdataFederation
.IBigdataFederation<?> getFederation()
UnsupportedOperationException
- if the IResourceManager
is not part of an
IBigdataFederation
.BTreeCounters getIndexCounters(String name)
BTreeCounters
for the named index. If none exist, then
a new instance is atomically created and returned to the caller. This
facilitates the reuse of the same BTreeCounters
instance for all
views of the named index.name
- The name of the index.null
.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.