@InterfaceAudience.Private public class HStoreFile extends Object implements StoreFile
StoreFileWriter.Builder and
append data. Be sure to add any metadata before calling close on the Writer (Use the
appendMetadata convenience methods). On close, a StoreFile is sitting in the Filesystem. To refer
to it, create a StoreFile instance passing filesystem and path. To read, call
initReader()
StoreFiles may also reference store files in another Store. The reason for this weird pattern where you use a different instance for the writer and a reader is that we write once but read a lot more.
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
BLOOM_FILTER_PARAM_KEY
Bloom filter param in FileInfo
|
static byte[] |
BLOOM_FILTER_TYPE_KEY
Bloom filter Type in FileInfo
|
static byte[] |
BULKLOAD_TASK_KEY
Meta key set when store file is a result of a bulk load
|
static byte[] |
BULKLOAD_TIME_KEY |
static byte[] |
COMPACTION_EVENT_KEY
Key for compaction event which contains the compacted storefiles in FileInfo
|
static byte[] |
DELETE_FAMILY_COUNT
Delete Family Count in FileInfo
|
static byte[] |
EARLIEST_PUT_TS
Key for timestamp of earliest-put in metadata
|
static byte[] |
EXCLUDE_FROM_MINOR_COMPACTION_KEY
Minor compaction flag in FileInfo
|
static byte[] |
LAST_BLOOM_KEY
Last Bloom filter key in FileInfo
|
static byte[] |
MAJOR_COMPACTION_KEY
Major compaction flag in FileInfo
|
static byte[] |
MAX_SEQ_ID_KEY
Max Sequence ID in FileInfo
|
static byte[] |
MOB_CELLS_COUNT
Key for the number of mob cells in metadata
|
static byte[] |
MOB_FILE_REFS
Key for the list of MOB file references
|
static byte[] |
NULL_VALUE
Null data
|
static byte[] |
SKIP_RESET_SEQ_ID
Key for skipping resetting sequence id in metadata.
|
static byte[] |
TIMERANGE_KEY
Key for Timerange information in metadata
|
| Constructor and Description |
|---|
HStoreFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf,
CacheConfig cacheConf,
BloomType cfBloomType,
boolean primaryReplica)
Constructor, loads a reader and it's indices, etc.
|
HStoreFile(StoreFileInfo fileInfo,
BloomType cfBloomType,
CacheConfig cacheConf)
Constructor, loads a reader and it's indices, etc.
|
HStoreFile(StoreFileInfo fileInfo,
BloomType cfBloomType,
CacheConfig cacheConf,
BloomFilterMetrics metrics)
Constructor, loads a reader and it's indices, etc.
|
| Modifier and Type | Method and Description |
|---|---|
void |
closeStoreFile(boolean evictOnClose) |
void |
deleteStoreFile()
Delete this file
|
boolean |
excludeFromMinorCompaction()
Returns True if this file should not be part of a minor compaction.
|
OptionalLong |
getBulkLoadTimestamp()
Return the timestamp at which this bulk load file was generated.
|
CacheConfig |
getCacheConf() |
CellComparator |
getComparator()
Get the comparator for comparing two cells.
|
org.apache.hadoop.fs.Path |
getEncodedPath()
Returns Encoded Path if this StoreFile was made with a Stream.
|
StoreFileInfo |
getFileInfo() |
Optional<Cell> |
getFirstKey()
Get the first key in this store file.
|
HDFSBlocksDistribution |
getHDFSBlockDistribution() |
Optional<Cell> |
getLastKey()
Get the last key in this store file.
|
OptionalLong |
getMaximumTimestamp()
Get the max timestamp of all the cells in the store file.
|
long |
getMaxMemStoreTS()
Get max of the MemstoreTS in the KV's in this store file.
|
long |
getMaxSequenceId()
Returns This files maximum edit sequence id.
|
byte[] |
getMetadataValue(byte[] key) |
OptionalLong |
getMinimumTimestamp()
Get the min timestamp of all the cells in the store file.
|
long |
getModificationTimestamp()
Get the modification time of this store file.
|
long |
getModificationTimeStamp()
Get the modification time of this store file.
|
org.apache.hadoop.fs.Path |
getPath()
Returns Path or null if this StoreFile was made with a Stream.
|
StoreFileScanner |
getPreadScanner(boolean cacheBlocks,
long readPt,
long scannerOrder,
boolean canOptimizeForNonNullColumn)
Get a scanner which uses pread.
|
org.apache.hadoop.fs.Path |
getQualifiedPath()
Returns Returns the qualified path of this StoreFile
|
StoreFileReader |
getReader() |
int |
getRefCount() |
StoreFileScanner |
getStreamScanner(boolean canUseDropBehind,
boolean cacheBlocks,
boolean isCompaction,
long readPt,
long scannerOrder,
boolean canOptimizeForNonNullColumn)
Get a scanner which uses streaming read.
|
void |
initReader()
Initialize the reader used for pread.
|
boolean |
isBulkLoadResult()
Check if this storefile was created by bulk load.
|
boolean |
isCompactedAway() |
boolean |
isHFile()
Returns True if this is HFile.
|
boolean |
isMajorCompactionResult()
Returns True if this file was made by a major compaction.
|
boolean |
isReference()
Returns True if this is a StoreFile Reference.
|
boolean |
isReferencedInReads()
Returns true if the file is still used in reads
|
void |
markCompactedAway() |
String |
toString() |
String |
toStringDetailed()
Returns a length description of this StoreFile, suitable for debug output
|
public static final byte[] MAX_SEQ_ID_KEY
public static final byte[] MAJOR_COMPACTION_KEY
public static final byte[] EXCLUDE_FROM_MINOR_COMPACTION_KEY
public static final byte[] COMPACTION_EVENT_KEY
public static final byte[] BLOOM_FILTER_TYPE_KEY
public static final byte[] BLOOM_FILTER_PARAM_KEY
public static final byte[] DELETE_FAMILY_COUNT
public static final byte[] LAST_BLOOM_KEY
public static final byte[] TIMERANGE_KEY
public static final byte[] EARLIEST_PUT_TS
public static final byte[] MOB_CELLS_COUNT
public static final byte[] NULL_VALUE
public static final byte[] MOB_FILE_REFS
public static final byte[] BULKLOAD_TASK_KEY
public static final byte[] BULKLOAD_TIME_KEY
public static final byte[] SKIP_RESET_SEQ_ID
public HStoreFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf,
CacheConfig cacheConf,
BloomType cfBloomType,
boolean primaryReplica)
throws IOException
fs - The current file system to use.p - The path of the file.conf - The current configuration.cacheConf - The cache configuration and block cache reference.cfBloomType - The bloom type to use for this store file as specified by column family
configuration. This may or may not be the same as the Bloom filter type
actually present in the HFile, because column family configuration might
change. If this is BloomType.NONE, the existing Bloom filter is
ignored.primaryReplica - true if this is a store file for primary replica, otherwise false.IOExceptionpublic HStoreFile(StoreFileInfo fileInfo, BloomType cfBloomType, CacheConfig cacheConf)
fileInfo - The store file information.cfBloomType - The bloom type to use for this store file as specified by column family
configuration. This may or may not be the same as the Bloom filter type
actually present in the HFile, because column family configuration might
change. If this is BloomType.NONE, the existing Bloom filter is
ignored.cacheConf - The cache configuration and block cache reference.public HStoreFile(StoreFileInfo fileInfo, BloomType cfBloomType, CacheConfig cacheConf, BloomFilterMetrics metrics)
fileInfo - The store file information.cfBloomType - The bloom type to use for this store file as specified by column family
configuration. This may or may not be the same as the Bloom filter type
actually present in the HFile, because column family configuration might
change. If this is BloomType.NONE, the existing Bloom filter is
ignored.cacheConf - The cache configuration and block cache reference.metrics - Tracks bloom filter requests and results. May be null.public CacheConfig getCacheConf()
public Optional<Cell> getFirstKey()
StoreFilegetFirstKey in interface StoreFilepublic Optional<Cell> getLastKey()
StoreFilegetLastKey in interface StoreFilepublic CellComparator getComparator()
StoreFilegetComparator in interface StoreFilepublic long getMaxMemStoreTS()
StoreFilegetMaxMemStoreTS in interface StoreFilepublic StoreFileInfo getFileInfo()
public org.apache.hadoop.fs.Path getPath()
StoreFilepublic org.apache.hadoop.fs.Path getEncodedPath()
StoreFilegetEncodedPath in interface StoreFilepublic org.apache.hadoop.fs.Path getQualifiedPath()
StoreFilegetQualifiedPath in interface StoreFilepublic boolean isReference()
StoreFileisReference in interface StoreFilepublic boolean isHFile()
StoreFilepublic boolean isMajorCompactionResult()
StoreFileisMajorCompactionResult in interface StoreFilepublic boolean excludeFromMinorCompaction()
StoreFileexcludeFromMinorCompaction in interface StoreFilepublic long getMaxSequenceId()
StoreFilegetMaxSequenceId in interface StoreFilepublic long getModificationTimeStamp()
throws IOException
StoreFilegetModificationTimeStamp in interface StoreFileIOExceptionStoreFile.getModificationTimestamp()public long getModificationTimestamp()
throws IOException
StoreFilegetModificationTimestamp in interface StoreFileIOExceptionpublic byte[] getMetadataValue(byte[] key)
key - to look uppublic boolean isBulkLoadResult()
StoreFile'_SeqId_<id-when-loaded>' to the hfile name, unless
"hbase.mapreduce.bulkload.assign.sequenceNumbers" is explicitly turned off. If
"hbase.mapreduce.bulkload.assign.sequenceNumbers" is turned off, fall back to
BULKLOAD_TIME_KEY.isBulkLoadResult in interface StoreFilepublic boolean isCompactedAway()
public int getRefCount()
public boolean isReferencedInReads()
public OptionalLong getBulkLoadTimestamp()
StoreFilegetBulkLoadTimestamp in interface StoreFilepublic HDFSBlocksDistribution getHDFSBlockDistribution()
public void initReader()
throws IOException
IOExceptionpublic StoreFileScanner getPreadScanner(boolean cacheBlocks, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn)
Must be called after initReader.
public StoreFileScanner getStreamScanner(boolean canUseDropBehind, boolean cacheBlocks, boolean isCompaction, long readPt, long scannerOrder, boolean canOptimizeForNonNullColumn) throws IOException
Must be called after initReader.
IOExceptionpublic StoreFileReader getReader()
initReader()public void closeStoreFile(boolean evictOnClose)
throws IOException
evictOnClose - whether to evict blocks belonging to this fileIOExceptionpublic void deleteStoreFile()
throws IOException
IOExceptionpublic void markCompactedAway()
public String toStringDetailed()
StoreFiletoStringDetailed in interface StoreFilepublic OptionalLong getMinimumTimestamp()
StoreFilegetMinimumTimestamp in interface StoreFilepublic OptionalLong getMaximumTimestamp()
StoreFilegetMaximumTimestamp in interface StoreFileCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.