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
Fields inherited from class org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexReader
blockDataSizes, blockOffsets, midKeyEntry, midLeafBlockOffset, midLeafBlockOnDiskSize, rootCount, searchTreeLevel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
add
(byte[] key, long offset, int dataSize) protected long
calculateHeapSizeForBlockKeys
(long heapSize) byte[]
getRootBlockKey
(int i) from 0 to- 1
protected void
initialize
(int numEntries) boolean
isEmpty()
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.int
rootBlockContainingKey
(byte[] key, int offset, int length, CellComparator comp) Finds the root-level index block containing the given key.int
Finds 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:
calculateHeapSizeForBlockKeys
in classHFileBlockIndex.BlockIndexReader
-
isEmpty
Description copied from class:HFileBlockIndex.BlockIndexReader
Returns true if the block index is empty.- Specified by:
isEmpty
in 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.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.- Specified by:
loadDataBlockWithScanInfo
in 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.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.- Specified by:
midkey
in classHFileBlockIndex.BlockIndexReader
- Returns:
- the first key of the middle block
- Throws:
IOException
-
initialize
- Specified by:
initialize
in classHFileBlockIndex.BlockIndexReader
-
add
- Specified by:
add
in classHFileBlockIndex.BlockIndexReader
-
rootBlockContainingKey
Description copied from class:HFileBlockIndex.BlockIndexReader
Finds the root-level index block containing the given key. Key to find the comparator to be used- Specified by:
rootBlockContainingKey
in 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.BlockIndexReader
Finds the root-level index block containing the given key. Key to find- Specified by:
rootBlockContainingKey
in classHFileBlockIndex.BlockIndexReader
-
toString
-