Package org.apache.hadoop.hbase.io.hfile
Class HFileBlockIndex.ByteArrayKeyBlockIndexReader
java.lang.Object
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.ByteArrayKeyBlockIndexReader
- All Implemented Interfaces:
HeapSize
- Enclosing class:
- HFileBlockIndex
An implementation of the BlockIndexReader that deals with block keys which are plain byte[]
like MetaBlock or the Bloom Block for ROW bloom. Does not need a comparator. It can work on
Bytes.BYTES_RAWCOMPARATOR
-
Field Summary
FieldsFields inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
blockDataSizes, blockOffsets, midKeyEntry, midLeafBlockOffset, midLeafBlockOnDiskSize, rootCount, searchTreeLevel -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(byte[] key, long offset, int dataSize) protected longcalculateHeapSizeForBlockKeys(long heapSize) byte[]getRootBlockKey(int i) from 0 to- 1protected voidinitialize(int numEntries) booleanisEmpty()Returns true if the block index is empty.loadDataBlockWithScanInfo(Cell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding, HFile.CachingBlockReader cachingBlockReader) Return the BlockWithScanInfo, a data structure which contains the Data HFileBlock with other scan info such as the key that starts the next HFileBlock.midkey(HFile.CachingBlockReader cachingBlockReader) An approximation to theHFile's mid-key.introotBlockContainingKey(byte[] key, int offset, int length, CellComparator comp) Finds the root-level index block containing the given key.intFinds the root-level index block containing the given key.toString()Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
binarySearchNonRootIndex, ensureNonEmpty, getNonRootIndexedKey, getRootBlockCount, getRootBlockDataSize, getRootBlockOffset, heapSize, locateNonRootIndexEntry, readMultiLevelIndexRoot, readRootIndex, readRootIndex, rootBlockContainingKey, seekToDataBlock
-
Field Details
-
blockKeys
-
-
Constructor Details
-
ByteArrayKeyBlockIndexReader
-
-
Method Details
-
calculateHeapSizeForBlockKeys
- Specified by:
calculateHeapSizeForBlockKeysin classHFileBlockIndex.BlockIndexReader
-
isEmpty
Description copied from class:HFileBlockIndex.BlockIndexReaderReturns true if the block index is empty.- Specified by:
isEmptyin classHFileBlockIndex.BlockIndexReader
-
getRootBlockKey
from 0 to- 1 -
loadDataBlockWithScanInfo
public BlockWithScanInfo loadDataBlockWithScanInfo(Cell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding, HFile.CachingBlockReader cachingBlockReader) throws IOException Description copied from class:HFileBlockIndex.BlockIndexReaderReturn the BlockWithScanInfo, a data structure which contains the Data HFileBlock with other scan info such as the key that starts the next HFileBlock. This function will only be called when the HFile version is larger than 1.- Specified by:
loadDataBlockWithScanInfoin classHFileBlockIndex.BlockIndexReader- Parameters:
key- the key we are looking forcurrentBlock- the current block, to avoid re-reading the same blockexpectedDataBlockEncoding- the data block encoding the caller is expecting the data block to be in, or null to not perform this check and return the block irrespective of the encoding.- Returns:
- the BlockWithScanInfo which contains the DataBlock with other scan info such as nextIndexedKey.
- Throws:
IOException
-
midkey
Description copied from class:HFileBlockIndex.BlockIndexReaderAn approximation to theHFile's mid-key. Operates on block boundaries, and does not go inside blocks. In other words, returns the first key of the middle block of the file.- Specified by:
midkeyin classHFileBlockIndex.BlockIndexReader- Returns:
- the first key of the middle block
- Throws:
IOException
-
initialize
- Specified by:
initializein classHFileBlockIndex.BlockIndexReader
-
add
- Specified by:
addin classHFileBlockIndex.BlockIndexReader
-
rootBlockContainingKey
Description copied from class:HFileBlockIndex.BlockIndexReaderFinds the root-level index block containing the given key. Key to find the comparator to be used- Specified by:
rootBlockContainingKeyin classHFileBlockIndex.BlockIndexReader- Returns:
- Offset of block containing
key(between 0 and the number of blocks - 1) or -1 if this file does not contain the request.
-
rootBlockContainingKey
Description copied from class:HFileBlockIndex.BlockIndexReaderFinds the root-level index block containing the given key. Key to find- Specified by:
rootBlockContainingKeyin classHFileBlockIndex.BlockIndexReader
-
toString
-