public class MetadataIndex extends BTree implements IMetadataIndex
PartitionLocator
objects.
Note: At this time the recommended scale-out approach for the metadata index
is to place the metadata indices on a MetadataService
(the same
MetadataService
may be used for an arbitrary #of scale-out indices)
and to replicate the state for the MetadataService
onto
failover MetadataService
s. Since the MetadataIndex
may grow
without bound, you simply need to have enough disk on hand for it (the size
requirements are quite modest). Further, the MetadataService
MUST NOT
be used to hold the data for the scale-out indices themselves since the
MetadataIndex
can not undergo IResourceManager.overflow()
.
One advantage of this approach is that the MetadataIndex
is
guaranteed to hold all historical states of the partition definitions for
each index - effectively it is an immortal store for the partition metadata.
On the other hand it is not possible to compact the metadata index without
taking the database offline.
Modifier and Type | Class and Description |
---|---|
static class |
MetadataIndex.MetadataIndexCheckpoint
Extends the
Checkpoint record to store the next partition
identifier to be assigned by the metadata index. |
static class |
MetadataIndex.MetadataIndexMetadata
Extends the
IndexMetadata record to hold the metadata template
for the managed scale-out index. |
static class |
MetadataIndex.PartitionLocatorTupleSerializer
Used to (de-)serialize
PartitionLocator s in the
MetadataIndex . |
BTree.Counter, BTree.LeafCursor, BTree.NodeFactory, BTree.PartitionedCounter, BTree.Stack
AbstractBTree.IBTreeCounters
counter, height, nentries, nleaves, nnodes, recordVersion
branchingFactor, debug, DEBUG, dumpLog, error, ERROR_CLOSED, ERROR_ERROR_STATE, ERROR_LESS_THAN_ZERO, ERROR_READ_ONLY, ERROR_TOO_LARGE, ERROR_TRANSIENT, INFO, log, metadata, ndistinctOnWriteRetentionQueue, nodeSer, readOnly, root, store, storeCache, writeRetentionQueue
Constructor and Description |
---|
MetadataIndex(IRawStore store,
Checkpoint checkpoint,
IndexMetadata metadata,
boolean readOnly)
Required ctor.
|
Modifier and Type | Method and Description |
---|---|
static MetadataIndex |
create(IRawStore store,
UUID indexUUID,
IndexMetadata managedIndexMetadata)
Create a new
MetadataIndex . |
PartitionLocator |
find(byte[] key)
Find and return the partition spanning the given key.
|
PartitionLocator |
get(byte[] key)
The partition with that separator key or
null (exact match
on the separator key). |
MetadataIndex.MetadataIndexMetadata |
getIndexMetadata()
The metadata for the index.
|
IndexMetadata |
getScaleOutIndexMetadata()
The metadata template for the scale-out index managed by this metadata
index.
|
int |
incrementAndGetNextPartitionId()
Returns the value to be assigned to the next partition created on this
MetadataIndex and then increments the counter. |
boolean |
needsCheckpoint()
Extended to require a checkpoint if
incrementAndGetNextPartitionId() has been
invoked. |
void |
staleLocator(PartitionLocator locator)
Passes the notice along to the
view . |
_reopen, asReadOnly, create, createTransient, createViewCheckpoint, fireDirtyEvent, getBloomFilter, getCheckpoint, getCounter, getDirtyListener, getEntryCount, getHeight, getLastCommitTime, getLeafCount, getMetadataAddr, getMutableBTree, getNodeCount, getRecordVersion, getRevisionTimestamp, getRootAddr, getSourceCount, getSources, getStore, handleCommit, invalidate, load, newLeafCursor, newLeafCursor, readBloomFilter, removeAll, setDirtyListener, setIndexMetadata, setLastCommitTime, writeCheckpoint, writeCheckpoint2
assertNotReadOnly, assertNotTransient, close, contains, contains, decodeRecordAddr, dump, dump, dumpPages, encodeRecordAddr, getBranchingFactor, getBtreeCounters, getContainsTuple, getCounters, getLevel, getLevel, getLookupTuple, getNodeSerializer, getReadLockCount, getResourceMetadata, getRightMostNode, getRoot, getRootOrFinger, getStatistics, getUtilization, getWriteTuple, indexOf, insert, insert, insert, isBalanced, isOpen, isReadOnly, isTransient, keyAt, lookup, lookup, lookup, putIfAbsent, rangeCheck, rangeCopy, rangeCount, rangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, rangeIterator, rangeIterator, rangeIterator, readLock, readNodeOrLeaf, recycle, remove, remove, remove, reopen, scan, setBTreeCounters, submit, submit, submit, toString, touch, valueAt, valueAt, writeLock, writeNodeOrLeaf, writeNodeRecursive, writeNodeRecursiveCallersThread, writeNodeRecursiveConcurrent
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
rangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, rangeIterator
close, dumpPages, isOpen, reopen
getCounters
rangeCount, scan
getReadLockCount, isReadOnly, readLock, writeLock
public MetadataIndex(IRawStore store, Checkpoint checkpoint, IndexMetadata metadata, boolean readOnly)
store
- checkpoint
- metadata
- public MetadataIndex.MetadataIndexMetadata getIndexMetadata()
AbstractBTree
Note: The same method is exposed by ICheckpointProtocol
. It is
also exposed here in order to provide access to the IndexMetadata
to remote clients in the scale-out architecture.
Note: If the B+Tree is read-only then the metadata object will be cloned to avoid potential modification. However, only a single cloned copy of the metadata record will be shared between all callers for a given instance of this class.
getIndexMetadata
in interface ICheckpointProtocol
getIndexMetadata
in interface IIndex
getIndexMetadata
in interface IMetadataIndex
getIndexMetadata
in class AbstractBTree
null
.ICheckpointProtocol.getIndexMetadata()
public IndexMetadata getScaleOutIndexMetadata()
IMetadataIndex
getScaleOutIndexMetadata
in interface IMetadataIndex
public int incrementAndGetNextPartitionId()
MetadataIndex
and then increments the counter. The counter will
be made restart-safe iff the index is dirty, the index is registered as
an ICommitter
, and the store on which the index is stored is
committed.
Note: The metadata index uses a 32-bit partition identifier rather than
the BTree.getCounter()
. The reason is that the Counter
uses
the partition identifier in the high word and a partition local counter
in the low word. Therefore we have to centralize the assignment of the
partition identifier, even when the metadata index is itself split into
partitions. Requests for partition identifiers need to be directed to the
root partition (L0) for the MetadataIndex
.
public static MetadataIndex create(IRawStore store, UUID indexUUID, IndexMetadata managedIndexMetadata)
MetadataIndex
.store
- The backing store.indexUUID
- The unique identifier for the metadata index.managedIndexMetadata
- The metadata template for the managed scale-out index.public boolean needsCheckpoint()
incrementAndGetNextPartitionId()
has been
invoked.needsCheckpoint
in class BTree
true
true iff changes would be lost unless the
B+Tree was flushed to the backing store using
BTree.writeCheckpoint()
.public PartitionLocator get(byte[] key)
IMetadataIndex
null
(exact match
on the separator key).get
in interface IMetadataIndex
key
- The separator key (the first key that would go into that
partition).null
.public PartitionLocator find(byte[] key)
IMetadataIndex
find
in interface IMetadataIndex
key
- A key (optional). When null
the locator for the
last index partition will be returned.null
if
there are no partitions defined.public void staleLocator(PartitionLocator locator)
view
. It caches de-serialized
locators and needs to drop them from its cache if they become stale.staleLocator
in interface IMetadataIndex
locator
- The locator.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.