Package org.apache.hadoop.hbase.io
Class HalfStoreFileReader
java.lang.Object
org.apache.hadoop.hbase.regionserver.StoreFileReader
org.apache.hadoop.hbase.io.HalfStoreFileReader
A facade for a
HFile.Reader that serves up either the
top or bottom half of a HFile where 'bottom' is the first half of the file containing the keys
that sort lowest and 'top' is the second half of the file with keys that sort greater than those
of the bottom half. The top includes the split files midkey, of the key that follows if it does
not exist in the file.
This type works in tandem with the Reference type. This class is used reading while
Reference is used writing.
This file is not splitable. Calls to midKey() return null.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicBooleanprivate Optional<ExtendedCell>private booleanprivate static final org.slf4j.Loggerprivate final ExtendedCellprotected final byte[](package private) final booleanFields inherited from class org.apache.hadoop.hbase.regionserver.StoreFileReader
bloomFilterType, conf, deleteFamilyBloomFilter, generalBloomFilter, reader, sequenceID, timeRange -
Constructor Summary
ConstructorsConstructorDescriptionHalfStoreFileReader(ReaderContext context, HFileInfo fileInfo, CacheConfig cacheConf, Reference r, StoreFileInfo storeFileInfo, org.apache.hadoop.conf.Configuration conf) Creates a half file reader for a hfile referred to by an hfilelink. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean evictOnClose) Overrides close method to handle cache evictions for the referred file.longlongThe number of Bloom filter entries in this store file, or an estimate thereof, if the Bloom filter is not loaded.protected HFileScannergetScanner(boolean cacheBlocks, boolean pread, boolean isCompaction) Will be overridden in HalfStoreFileReaderprotected booleanisTop()midKey()booleanpassesKeyRangeFilter(Scan scan) Checks whether the given scan rowkey range overlaps with the current storefile'sMethods inherited from class org.apache.hadoop.hbase.regionserver.StoreFileReader
getBloomFilterType, getComparator, getDeleteFamilyCnt, getGeneralBloomFilter, getHFileMinorVersion, getHFileReader, getHFileVersion, getLastRowKey, getMaxTimestamp, getPrefixLength, getReaderContext, getSequenceID, getStoreFileScanner, getTotalBloomSize, getTotalUncompressedBytes, indexSize, isBulkLoaded, isPrimaryReplicaReader, length, loadBloomfilter, loadFileInfo, passesDeleteFamilyBloomFilter, passesGeneralRowColBloomFilter, setBulkLoaded, setSequenceID
-
Field Details
-
LOG
-
top
-
splitkey
-
splitCell
-
firstKey
-
firstKeySeeked
-
closed
-
-
Constructor Details
-
HalfStoreFileReader
public HalfStoreFileReader(ReaderContext context, HFileInfo fileInfo, CacheConfig cacheConf, Reference r, StoreFileInfo storeFileInfo, org.apache.hadoop.conf.Configuration conf) throws IOException Creates a half file reader for a hfile referred to by an hfilelink.- Parameters:
context- Reader context infofileInfo- HFile infocacheConf- CacheConfigr- original reference file (contains top or bottom)conf- Configuration- Throws:
IOException
-
-
Method Details
-
isTop
-
getScanner
Description copied from class:StoreFileReaderWill be overridden in HalfStoreFileReader- Overrides:
getScannerin classStoreFileReader
-
passesKeyRangeFilter
Description copied from class:StoreFileReaderChecks whether the given scan rowkey range overlaps with the current storefile's- Overrides:
passesKeyRangeFilterin classStoreFileReader- Parameters:
scan- the scan specification. Used to determine the rowkey range.- Returns:
- true if there is overlap, false otherwise
-
getLastKey
- Overrides:
getLastKeyin classStoreFileReader
-
midKey
- Overrides:
midKeyin classStoreFileReader- Throws:
IOException
-
getFirstKey
- Overrides:
getFirstKeyin classStoreFileReader
-
getEntries
- Overrides:
getEntriesin classStoreFileReader
-
getFilterEntries
Description copied from class:StoreFileReaderThe number of Bloom filter entries in this store file, or an estimate thereof, if the Bloom filter is not loaded. This always returns an upper bound of the number of Bloom filter entries.- Overrides:
getFilterEntriesin classStoreFileReader- Returns:
- an estimate of the number of Bloom filter entries in this file
-
close
Overrides close method to handle cache evictions for the referred file. If evictionOnClose is true, we will seek to the block containing the splitCell and evict all blocks from offset 0 up to that block offset if this is a bottom half reader, or the from the split block offset up to the end of the file if this is a top half reader.- Overrides:
closein classStoreFileReader- Parameters:
evictOnClose- true if it should evict the file blocks from the cache.- Throws:
IOException
-