Class StoreFileReader
java.lang.Object
org.apache.hadoop.hbase.regionserver.StoreFileReader
- Direct Known Subclasses:
HalfStoreFileReader
Reader for a StoreFile.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BloomFilterMetricsprotected BloomTypeprivate booleanprotected org.apache.hadoop.conf.Configurationprivate final ReaderContextprotected BloomFilterprivate longprotected BloomFilterprivate byte[]private KeyValue.KeyOnlyKeyValueprivate static final org.slf4j.Loggerprivate intprotected final HFile.Readerprotected longprivate booleanprivate final StoreFileInfoAllStoreFileReaderfor the same StoreFile will share theStoreFileInfo.refCount.protected TimeRange -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)ONLY USE DEFAULT CONSTRUCTOR FOR UNIT TESTSprivateStoreFileReader(HFile.Reader reader, StoreFileInfo storeFileInfo, ReaderContext context, org.apache.hadoop.conf.Configuration conf) StoreFileReader(ReaderContext context, HFileInfo fileInfo, CacheConfig cacheConf, StoreFileInfo storeFileInfo, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckGeneralBloomFilter(byte[] key, Cell kvKey, BloomFilter bloomFilter) voidclose(boolean evictOnClose) (package private) voidcopyFields(StoreFileReader storeFileReader) (package private) voidlonglonglongThe number of Bloom filter entries in this store file, or an estimate thereof, if the Bloom filter is not loaded.intintOptional<byte[]>longint(package private) intReturn the ref count associated with the reader whenever a scanner associated with the reader is opened.protected HFileScannergetScanner(boolean cacheBlocks, boolean pread, boolean isCompaction) Will be overridden in HalfStoreFileReaderlonggetStoreFileScanner(boolean cacheBlocks, boolean pread, boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) Get a scanner to scan over this StoreFile.longlong(package private) long(package private) voidIndicate that the scanner has started reading with this reader.longbooleanboolean(package private) booleanlonglength()(package private) voidvoidloadBloomfilter(BlockType blockType, BloomFilterMetrics metrics) Map<byte[],byte[]> midKey()(package private) booleanpassesBloomFilter(Scan scan, SortedSet<byte[]> columns) Checks whether the given scan passes the Bloom filter (if present).booleanpassesDeleteFamilyBloomFilter(byte[] row, int rowOffset, int rowLen) private booleanpassesGeneralRowBloomFilter(byte[] row, int rowOffset, int rowLen) A method for checking Bloom filters.booleanA method for checking Bloom filters.private booleanA method for checking Bloom filters.booleanpassesKeyRangeFilter(Scan scan) Checks whether the given scan rowkey range overlaps with the current storefile's(package private) booleanpassesTimerangeFilter(TimeRange tr, long oldestUnexpiredTS) Check if this storeFile may contain keys within the TimeRange that have not expired (i.e.(package private) voidIndicate that the scanner has finished reading with this reader.(package private) voidsetBloomFilterFaulty(BlockType blockType) voidsetBulkLoaded(boolean bulkLoadResult) private voidprivate voidvoidsetSequenceID(long sequenceID) (package private) voidsetSkipResetSeqId(boolean skipResetSeqId)
-
Field Details
-
LOG
-
generalBloomFilter
-
deleteFamilyBloomFilter
-
bloomFilterMetrics
-
bloomFilterType
-
reader
-
sequenceID
-
timeRange
-
lastBloomKey
-
deleteFamilyCnt
-
bulkLoadResult
-
lastBloomKeyOnlyKV
-
skipResetSeqId
-
prefixLength
-
conf
-
storeFileInfo
AllStoreFileReaderfor the same StoreFile will share theStoreFileInfo.refCount. Counter that is incremented every time a scanner is created on the store file. It is decremented when the scan on the store file is done. -
context
-
-
Constructor Details
-
StoreFileReader
private StoreFileReader(HFile.Reader reader, StoreFileInfo storeFileInfo, ReaderContext context, org.apache.hadoop.conf.Configuration conf) -
StoreFileReader
public StoreFileReader(ReaderContext context, HFileInfo fileInfo, CacheConfig cacheConf, StoreFileInfo storeFileInfo, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
StoreFileReader
@Private StoreFileReader()ONLY USE DEFAULT CONSTRUCTOR FOR UNIT TESTS
-
-
Method Details
-
copyFields
- Throws:
IOException
-
isPrimaryReplicaReader
-
getComparator
-
getStoreFileScanner
public StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread, boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) Get a scanner to scan over this StoreFile.- Parameters:
cacheBlocks- should this scanner cache blocks?pread- use pread (for highly concurrent small readers)isCompaction- is scanner being used for compaction?scannerOrder- Order of this scanner relative to other scanners. SeeKeyValueScanner.getScannerOrder().canOptimizeForNonNullColumn-trueif we can make sure there is no null column, otherwisefalse. This is a hint for optimization.- Returns:
- a scanner
-
getRefCount
int getRefCount()Return the ref count associated with the reader whenever a scanner associated with the reader is opened. -
incrementRefCount
void incrementRefCount()Indicate that the scanner has started reading with this reader. We need to increment the ref count so reader is not close until some object is holding the lock -
readCompleted
void readCompleted()Indicate that the scanner has finished reading with this reader. We need to decrement the ref count, and also, if this is not the common pread reader, we should close it. -
getScanner
Will be overridden in HalfStoreFileReader -
close
- Throws:
IOException
-
passesTimerangeFilter
Check if this storeFile may contain keys within the TimeRange that have not expired (i.e. not older than oldestUnexpiredTS).- Parameters:
tr- the timeRange to restrictoldestUnexpiredTS- the oldest timestamp that is not expired, as determined by the column family's TTL- Returns:
- false if queried keys definitely don't exist in this StoreFile
-
passesBloomFilter
Checks whether the given scan passes the Bloom filter (if present). Only checks Bloom filters for single-row or single-row-column scans. Bloom filter checking for multi-gets is implemented as part of the store scanner system (seeStoreFileScanner#seek(Cell)and uses the lower-level APIpassesGeneralRowBloomFilter(byte[], int, int)and#passesGeneralRowColBloomFilter(Cell).- Parameters:
scan- the scan specification. Used to determine the row, and to check whether this is a single-row ("get") scan.columns- the set of columns. Only used for row-column Bloom filters.- Returns:
- true if the scan with the given column set passes the Bloom filter, or if the Bloom filter is not applicable for the scan. False if the Bloom filter is applicable and the scan fails it.
-
passesDeleteFamilyBloomFilter
-
passesGeneralRowBloomFilter
A method for checking Bloom filters. Called directly from StoreFileScanner in case of a multi-column query.- Returns:
- True if passes
-
passesGeneralRowColBloomFilter
A method for checking Bloom filters. Called directly from StoreFileScanner in case of a multi-column query. the cell to check if present in BloomFilter- Returns:
- True if passes
-
passesGeneralRowPrefixBloomFilter
A method for checking Bloom filters. Called directly from StoreFileScanner in case of a multi-column query.- Returns:
- True if passes
-
checkGeneralBloomFilter
-
passesKeyRangeFilter
Checks whether the given scan rowkey range overlaps with the current storefile's- Parameters:
scan- the scan specification. Used to determine the rowkey range.- Returns:
- true if there is overlap, false otherwise
-
loadFileInfo
- Throws:
IOException
-
loadBloomfilter
void loadBloomfilter() -
loadBloomfilter
-
setBloomFilterFaulty
-
getFilterEntries
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.- Returns:
- an estimate of the number of Bloom filter entries in this file
-
setGeneralBloomFilterFaulty
-
setDeleteFamilyBloomFilterFaulty
-
getLastKey
-
getLastRowKey
-
midKey
- Throws:
IOException
-
length
-
getTotalUncompressedBytes
-
getEntries
-
getDeleteFamilyCnt
-
getFirstKey
-
indexSize
-
getBloomFilterType
-
getSequenceID
-
setSequenceID
-
setBulkLoaded
-
isBulkLoaded
-
getGeneralBloomFilter
-
getUncompressedDataIndexSize
long getUncompressedDataIndexSize() -
getTotalBloomSize
-
getHFileVersion
-
getHFileMinorVersion
-
getHFileReader
-
disableBloomFilterForTesting
void disableBloomFilterForTesting() -
getMaxTimestamp
-
isSkipResetSeqId
boolean isSkipResetSeqId() -
setSkipResetSeqId
-
getPrefixLength
-
getReaderContext
-