org.apache.hadoop.hbase.regionserver
Class StoreFile.Reader

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured
      extended by org.apache.hadoop.hbase.regionserver.StoreFile.Reader
All Implemented Interfaces:
HeapSize, SchemaMetrics.SchemaAware
Direct Known Subclasses:
HalfStoreFileReader
Enclosing class:
StoreFile

public static class StoreFile.Reader
extends SchemaConfigured

Reader for a StoreFile.


Field Summary
protected  StoreFile.BloomType bloomFilterType
           
protected  BloomFilter deleteFamilyBloomFilter
           
protected  BloomFilter generalBloomFilter
           
protected  long sequenceID
           
protected  TimeRangeTracker timeRangeTracker
           
 
Fields inherited from class org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured
SCHEMA_CONFIGURED_UNALIGNED_HEAP_SIZE
 
Constructor Summary
StoreFile.Reader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, CacheConfig cacheConf, DataBlockEncoding preferredEncodingInCache)
           
StoreFile.Reader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, HFileLink hfileLink, long size, CacheConfig cacheConf, DataBlockEncoding preferredEncodingInCache, boolean closeIStream)
           
 
Method Summary
 void close(boolean evictOnClose)
           
 StoreFile.BloomType getBloomFilterType()
           
 String getColumnFamilyName()
           
 org.apache.hadoop.io.RawComparator<byte[]> getComparator()
           
 long getDeleteFamilyCnt()
           
 long getEntries()
           
 long getFilterEntries()
          The number of Bloom filter entries in this store file, or an estimate thereof, if the Bloom filter is not loaded.
 byte[] getFirstKey()
           
 int getHFileVersion()
           
 byte[] getLastKey()
           
 long getMaxTimestamp()
           
 HFileScanner getScanner(boolean cacheBlocks, boolean pread)
          Deprecated. 
 HFileScanner getScanner(boolean cacheBlocks, boolean pread, boolean isCompaction)
          Deprecated. 
 long getSequenceID()
           
 StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread)
          Get a scanner to scan over this StoreFile.
 StoreFileScanner getStoreFileScanner(boolean cacheBlocks, boolean pread, boolean isCompaction)
          Get a scanner to scan over this StoreFile.
 long getTotalBloomSize()
           
 long getTotalUncompressedBytes()
           
 long indexSize()
           
 long length()
           
 void loadBloomfilter()
           
 Map<byte[],byte[]> loadFileInfo()
           
 byte[] midkey()
           
 boolean passesDeleteFamilyBloomFilter(byte[] row, int rowOffset, int rowLen)
           
 boolean passesGeneralBloomFilter(byte[] row, int rowOffset, int rowLen, byte[] col, int colOffset, int colLen)
          A method for checking Bloom filters.
 boolean passesKeyRangeFilter(Scan scan)
          Checks whether the given scan rowkey range overlaps with the current storefile's
 void schemaConfigurationChanged()
          A hook method called when schema configuration changes.
 void setDeleteFamilyBloomFilterFaulty()
           
 void setGeneralBloomFilterFaulty()
           
 void setSequenceID(long sequenceID)
           
 
Methods inherited from class org.apache.hadoop.hbase.regionserver.metrics.SchemaConfigured
createUnknown, getSchemaMetrics, getTableName, heapSize, isSchemaConfigured, passSchemaMetricsTo, resetSchemaMetricsConf, schemaConfAsJSON
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

generalBloomFilter

protected BloomFilter generalBloomFilter

deleteFamilyBloomFilter

protected BloomFilter deleteFamilyBloomFilter

bloomFilterType

protected StoreFile.BloomType bloomFilterType

timeRangeTracker

protected TimeRangeTracker timeRangeTracker

sequenceID

protected long sequenceID
Constructor Detail

StoreFile.Reader

public StoreFile.Reader(org.apache.hadoop.fs.FileSystem fs,
                        org.apache.hadoop.fs.Path path,
                        CacheConfig cacheConf,
                        DataBlockEncoding preferredEncodingInCache)
                 throws IOException
Throws:
IOException

StoreFile.Reader

public StoreFile.Reader(org.apache.hadoop.fs.FileSystem fs,
                        org.apache.hadoop.fs.Path path,
                        HFileLink hfileLink,
                        long size,
                        CacheConfig cacheConf,
                        DataBlockEncoding preferredEncodingInCache,
                        boolean closeIStream)
                 throws IOException
Throws:
IOException
Method Detail

getComparator

public org.apache.hadoop.io.RawComparator<byte[]> getComparator()

getStoreFileScanner

public StoreFileScanner getStoreFileScanner(boolean cacheBlocks,
                                            boolean pread)
Get a scanner to scan over this StoreFile. Do not use this overload if using this scanner for compactions.

Parameters:
cacheBlocks - should this scanner cache blocks?
pread - use pread (for highly concurrent small readers)
Returns:
a scanner

getStoreFileScanner

public StoreFileScanner getStoreFileScanner(boolean cacheBlocks,
                                            boolean pread,
                                            boolean isCompaction)
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?
Returns:
a scanner

getScanner

@Deprecated
public HFileScanner getScanner(boolean cacheBlocks,
                                          boolean pread)
Deprecated. 

Warning: Do not write further code which depends on this call. Instead use getStoreFileScanner() which uses the StoreFileScanner class/interface which is the preferred way to scan a store with higher level concepts.

Parameters:
cacheBlocks - should we cache the blocks?
pread - use pread (for concurrent small readers)
Returns:
the underlying HFileScanner

getScanner

@Deprecated
public HFileScanner getScanner(boolean cacheBlocks,
                                          boolean pread,
                                          boolean isCompaction)
Deprecated. 

Warning: Do not write further code which depends on this call. Instead use getStoreFileScanner() which uses the StoreFileScanner class/interface which is the preferred way to scan a store with higher level concepts.

Parameters:
cacheBlocks - should we cache the blocks?
pread - use pread (for concurrent small readers)
isCompaction - is scanner being used for compaction?
Returns:
the underlying HFileScanner

close

public void close(boolean evictOnClose)
           throws IOException
Throws:
IOException

passesDeleteFamilyBloomFilter

public boolean passesDeleteFamilyBloomFilter(byte[] row,
                                             int rowOffset,
                                             int rowLen)

passesGeneralBloomFilter

public boolean passesGeneralBloomFilter(byte[] row,
                                        int rowOffset,
                                        int rowLen,
                                        byte[] col,
                                        int colOffset,
                                        int colLen)
A method for checking Bloom filters. Called directly from StoreFileScanner in case of a multi-column query.

Parameters:
row -
rowOffset -
rowLen -
col -
colOffset -
colLen -
Returns:
True if passes

passesKeyRangeFilter

public boolean passesKeyRangeFilter(Scan scan)
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

public Map<byte[],byte[]> loadFileInfo()
                                throws IOException
Throws:
IOException

loadBloomfilter

public void loadBloomfilter()

getFilterEntries

public long 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

public void setGeneralBloomFilterFaulty()

setDeleteFamilyBloomFilterFaulty

public void setDeleteFamilyBloomFilterFaulty()

getLastKey

public byte[] getLastKey()

midkey

public byte[] midkey()
              throws IOException
Throws:
IOException

length

public long length()

getTotalUncompressedBytes

public long getTotalUncompressedBytes()

getEntries

public long getEntries()

getDeleteFamilyCnt

public long getDeleteFamilyCnt()

getFirstKey

public byte[] getFirstKey()

indexSize

public long indexSize()

getColumnFamilyName

public String getColumnFamilyName()
Specified by:
getColumnFamilyName in interface SchemaMetrics.SchemaAware
Overrides:
getColumnFamilyName in class SchemaConfigured

getBloomFilterType

public StoreFile.BloomType getBloomFilterType()

getSequenceID

public long getSequenceID()

setSequenceID

public void setSequenceID(long sequenceID)

getTotalBloomSize

public long getTotalBloomSize()

getHFileVersion

public int getHFileVersion()

getMaxTimestamp

public long getMaxTimestamp()

schemaConfigurationChanged

public void schemaConfigurationChanged()
Description copied from class: SchemaConfigured
A hook method called when schema configuration changes. Can be used to update schema-aware member fields.

Overrides:
schemaConfigurationChanged in class SchemaConfigured


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.