Package org.apache.hadoop.hbase.io.hfile
Class HFileBlockIndex.CellBasedKeyBlockIndexReaderV2
java.lang.Object
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.CellBasedKeyBlockIndexReader
org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.CellBasedKeyBlockIndexReaderV2
- All Implemented Interfaces:
HeapSize
- Enclosing class:
- HFileBlockIndex
-
Field Summary
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.CellBasedKeyBlockIndexReader
comparator
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
blockDataSizes, blockOffsets, midKeyEntry, midLeafBlockOffset, midLeafBlockOnDiskSize, rootCount, searchTreeLevel
-
Constructor Summary
ConstructorDescriptionCellBasedKeyBlockIndexReaderV2
(CellComparator c, int treeLevel) CellBasedKeyBlockIndexReaderV2
(CellComparator c, int treeLevel, HFileIndexBlockEncoder indexBlockEncoder) -
Method Summary
Modifier and TypeMethodDescriptionprotected long
calculateHeapSizeForBlockKeys
(long heapSize) int
Returns the number of root-level blocks in this block indexgetRootBlockKey
(int i) from 0 to- 1
boolean
isEmpty()
Returns true if the block index is empty.loadDataBlockWithScanInfo
(ExtendedCell 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.void
readMultiLevelIndexRoot
(HFileBlock blk, int numEntries) Read the root-level metadata of a multi-level block index.int
Finds the root-level index block containing the given key.toString()
Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.CellBasedKeyBlockIndexReader
add, initialize, rootBlockContainingKey
Methods inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
binarySearchNonRootIndex, ensureNonEmpty, getNonRootIndexedKey, getRootBlockDataSize, getRootBlockOffset, heapSize, locateNonRootIndexEntry, readRootIndex, readRootIndex, rootBlockContainingKey, seekToDataBlock
-
Field Details
-
indexBlockEncoder
-
seeker
-
-
Constructor Details
-
CellBasedKeyBlockIndexReaderV2
-
CellBasedKeyBlockIndexReaderV2
public CellBasedKeyBlockIndexReaderV2(CellComparator c, int treeLevel, HFileIndexBlockEncoder indexBlockEncoder)
-
-
Method Details
-
isEmpty
Description copied from class:HFileBlockIndex.BlockIndexReader
Returns true if the block index is empty.- Overrides:
isEmpty
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
-
loadDataBlockWithScanInfo
public BlockWithScanInfo loadDataBlockWithScanInfo(ExtendedCell key, HFileBlock currentBlock, boolean cacheBlocks, boolean pread, boolean isCompaction, DataBlockEncoding expectedDataBlockEncoding, HFile.CachingBlockReader cachingBlockReader) throws IOException Description copied from class:HFileBlockIndex.BlockIndexReader
Return 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.- Overrides:
loadDataBlockWithScanInfo
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
- 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.BlockIndexReader
An 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.- Overrides:
midkey
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
- Returns:
- the first key of the middle block
- Throws:
IOException
-
getRootBlockKey
from 0 to- 1
- Overrides:
getRootBlockKey
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
-
getRootBlockCount
Description copied from class:HFileBlockIndex.BlockIndexReader
Returns the number of root-level blocks in this block index- Overrides:
getRootBlockCount
in classHFileBlockIndex.BlockIndexReader
-
rootBlockContainingKey
Description copied from class:HFileBlockIndex.BlockIndexReader
Finds the root-level index block containing the given key. Key to find- Overrides:
rootBlockContainingKey
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
-
calculateHeapSizeForBlockKeys
- Overrides:
calculateHeapSizeForBlockKeys
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
-
readMultiLevelIndexRoot
Description copied from class:HFileBlockIndex.BlockIndexReader
Read the root-level metadata of a multi-level block index. Based onHFileBlockIndex.BlockIndexReader.readRootIndex(DataInput, int)
, but also reads metadata necessary to compute the mid-key in a multi-level index.- Overrides:
readMultiLevelIndexRoot
in classHFileBlockIndex.BlockIndexReader
- Parameters:
blk
- the HFile blocknumEntries
- the number of root-level index entries- Throws:
IOException
-
toString
- Overrides:
toString
in classHFileBlockIndex.CellBasedKeyBlockIndexReader
-