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
Modifier and TypeFieldDescriptionprivate AtomicBoolean
private Optional<ExtendedCell>
private boolean
private static final org.slf4j.Logger
private final ExtendedCell
protected final byte[]
(package private) final boolean
Fields inherited from class org.apache.hadoop.hbase.regionserver.StoreFileReader
bloomFilterType, conf, deleteFamilyBloomFilter, generalBloomFilter, reader, sequenceID, timeRange
-
Constructor Summary
ConstructorDescriptionHalfStoreFileReader
(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 TypeMethodDescriptionvoid
close
(boolean evictOnClose) Overrides close method to handle cache evictions for the referred file.long
long
The number of Bloom filter entries in this store file, or an estimate thereof, if the Bloom filter is not loaded.protected HFileScanner
getScanner
(boolean cacheBlocks, boolean pread, boolean isCompaction) Will be overridden in HalfStoreFileReaderprotected boolean
isTop()
midKey()
boolean
passesKeyRangeFilter
(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, 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:StoreFileReader
Will be overridden in HalfStoreFileReader- Overrides:
getScanner
in classStoreFileReader
-
passesKeyRangeFilter
Description copied from class:StoreFileReader
Checks whether the given scan rowkey range overlaps with the current storefile's- Overrides:
passesKeyRangeFilter
in classStoreFileReader
- Parameters:
scan
- the scan specification. Used to determine the rowkey range.- Returns:
- true if there is overlap, false otherwise
-
getLastKey
- Overrides:
getLastKey
in classStoreFileReader
-
midKey
- Overrides:
midKey
in classStoreFileReader
- Throws:
IOException
-
getFirstKey
- Overrides:
getFirstKey
in classStoreFileReader
-
getEntries
- Overrides:
getEntries
in classStoreFileReader
-
getFilterEntries
Description copied from class:StoreFileReader
The 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:
getFilterEntries
in 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:
close
in classStoreFileReader
- Parameters:
evictOnClose
- true if it should evict the file blocks from the cache.- Throws:
IOException
-