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 MetadataServices. 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
PartitionLocators in the
MetadataIndex. |
BTree.Counter, BTree.LeafCursor, BTree.NodeFactory, BTree.PartitionedCounter, BTree.StackAbstractBTree.IBTreeCounterscounter, height, nentries, nleaves, nnodes, recordVersionbranchingFactor, 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, writeCheckpoint2assertNotReadOnly, 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, writeNodeRecursiveConcurrentclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitrangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, rangeIteratorclose, dumpPages, isOpen, reopengetCountersrangeCount, scangetReadLockCount, isReadOnly, readLock, writeLockpublic 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 ICheckpointProtocolgetIndexMetadata in interface IIndexgetIndexMetadata in interface IMetadataIndexgetIndexMetadata in class AbstractBTreenull.ICheckpointProtocol.getIndexMetadata()public IndexMetadata getScaleOutIndexMetadata()
IMetadataIndexgetScaleOutIndexMetadata in interface IMetadataIndexpublic 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 BTreetrue true iff changes would be lost unless the
B+Tree was flushed to the backing store using
BTree.writeCheckpoint().public PartitionLocator get(byte[] key)
IMetadataIndexnull (exact match
on the separator key).get in interface IMetadataIndexkey - The separator key (the first key that would go into that
partition).null.public PartitionLocator find(byte[] key)
IMetadataIndexfind in interface IMetadataIndexkey - 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 IMetadataIndexlocator - The locator.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.