@InterfaceAudience.LimitedPrivate(value="Coprocessor") public class StoreFile extends Object
StoreFile.WriterBuilder
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 createReader()
.
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 | Class and Description |
---|---|
static class |
StoreFile.Comparators
Useful comparators for comparing StoreFiles.
|
static class |
StoreFile.Reader
Reader for a StoreFile.
|
static class |
StoreFile.Writer
A StoreFile writer.
|
static class |
StoreFile.WriterBuilder |
Modifier and Type | Field and Description |
---|---|
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 |
private CacheConfig |
cacheConf |
private BloomType |
cfBloomType
Bloom filter type specified in column family configuration.
|
private KeyValue.KVComparator |
comparator |
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
|
private boolean |
excludeFromMinorCompaction |
private StoreFileInfo |
fileInfo |
private byte[] |
firstKey |
private org.apache.hadoop.fs.FileSystem |
fs |
private static byte[] |
LAST_BLOOM_KEY
Last Bloom filter key in FileInfo
|
private byte[] |
lastKey |
private static org.apache.commons.logging.Log |
LOG |
static byte[] |
MAJOR_COMPACTION_KEY
Major compaction flag in FileInfo
|
private AtomicBoolean |
majorCompaction |
static byte[] |
MAX_SEQ_ID_KEY
Max Sequence ID in FileInfo
|
private long |
maxMemstoreTS |
private Map<byte[],byte[]> |
metadataMap
Map of the metadata entries in the corresponding HFile
|
private StoreFile.Reader |
reader |
private long |
sequenceid |
static byte[] |
TIMERANGE_KEY
Key for Timerange information in metadata
|
Constructor and Description |
---|
StoreFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.conf.Configuration conf,
CacheConfig cacheConf,
BloomType cfBloomType)
Constructor, loads a reader and it's indices, etc.
|
StoreFile(org.apache.hadoop.fs.FileSystem fs,
StoreFileInfo fileInfo,
org.apache.hadoop.conf.Configuration conf,
CacheConfig cacheConf,
BloomType cfBloomType)
Constructor, loads a reader and it's indices, etc.
|
StoreFile(StoreFile other)
Clone
|
Modifier and Type | Method and Description |
---|---|
void |
closeReader(boolean evictOnClose) |
StoreFile.Reader |
createReader() |
StoreFile.Reader |
createReader(boolean canUseDropBehind) |
void |
deleteReader()
Delete this file
|
boolean |
excludeFromMinorCompaction() |
long |
getBulkLoadTimestamp()
Return the timestamp at which this bulk load file was generated.
|
(package private) CacheConfig |
getCacheConf() |
KeyValue.KVComparator |
getComparator() |
StoreFileInfo |
getFileInfo() |
(package private) byte[] |
getFileSplitPoint(KeyValue.KVComparator comparator)
Gets the approximate mid-point of this file that is optimal for use in splitting it.
|
byte[] |
getFirstKey() |
HDFSBlocksDistribution |
getHDFSBlockDistribution() |
byte[] |
getLastKey() |
long |
getMaxMemstoreTS() |
static long |
getMaxMemstoreTSInList(Collection<StoreFile> sfs)
Return the largest memstoreTS found across all storefiles in
the given list.
|
long |
getMaxSequenceId() |
static long |
getMaxSequenceIdInList(Collection<StoreFile> sfs)
Return the highest sequence ID found across all storefiles in
the given list.
|
byte[] |
getMetadataValue(byte[] key)
Only used by the Striped Compaction Policy
|
Long |
getMinimumTimestamp() |
long |
getModificationTimeStamp() |
org.apache.hadoop.fs.Path |
getPath() |
org.apache.hadoop.fs.Path |
getQualifiedPath() |
StoreFile.Reader |
getReader() |
static org.apache.hadoop.fs.Path |
getUniqueFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir) |
(package private) boolean |
isBulkLoadResult()
Check if this storefile was created by bulk load.
|
boolean |
isMajorCompaction() |
boolean |
isReference() |
private StoreFile.Reader |
open(boolean canUseDropBehind)
Opens reader on this store file.
|
void |
setMaxMemstoreTS(long maxMemstoreTS) |
String |
toString() |
String |
toStringDetailed() |
private static final org.apache.commons.logging.Log LOG
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[] BLOOM_FILTER_TYPE_KEY
public static final byte[] DELETE_FAMILY_COUNT
private static final byte[] LAST_BLOOM_KEY
public static final byte[] TIMERANGE_KEY
public static final byte[] EARLIEST_PUT_TS
private final StoreFileInfo fileInfo
private final org.apache.hadoop.fs.FileSystem fs
private final CacheConfig cacheConf
private long sequenceid
private long maxMemstoreTS
private byte[] firstKey
private byte[] lastKey
private KeyValue.KVComparator comparator
private AtomicBoolean majorCompaction
private boolean excludeFromMinorCompaction
public static final byte[] BULKLOAD_TASK_KEY
public static final byte[] BULKLOAD_TIME_KEY
private Map<byte[],byte[]> metadataMap
private volatile StoreFile.Reader reader
private final BloomType cfBloomType
public StoreFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType cfBloomType) 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.IOException
- When opening the reader fails.public StoreFile(org.apache.hadoop.fs.FileSystem fs, StoreFileInfo fileInfo, org.apache.hadoop.conf.Configuration conf, CacheConfig cacheConf, BloomType cfBloomType) throws IOException
fs
- The current file system to use.fileInfo
- The store file information.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.IOException
- When opening the reader fails.public StoreFile(StoreFile other)
other
- The StoreFile to clone fromCacheConfig getCacheConf()
public byte[] getFirstKey()
public byte[] getLastKey()
public KeyValue.KVComparator getComparator()
public long getMaxMemstoreTS()
public void setMaxMemstoreTS(long maxMemstoreTS)
public StoreFileInfo getFileInfo()
public org.apache.hadoop.fs.Path getPath()
public org.apache.hadoop.fs.Path getQualifiedPath()
public boolean isReference()
open(boolean canUseDropBehind)
else may get wrong answer.public boolean isMajorCompaction()
public boolean excludeFromMinorCompaction()
public long getMaxSequenceId()
public long getModificationTimeStamp() throws IOException
IOException
public byte[] getMetadataValue(byte[] key)
key
- public static long getMaxMemstoreTSInList(Collection<StoreFile> sfs)
public static long getMaxSequenceIdInList(Collection<StoreFile> sfs)
sfs
- boolean isBulkLoadResult()
public long getBulkLoadTimestamp()
public HDFSBlocksDistribution getHDFSBlockDistribution()
private StoreFile.Reader open(boolean canUseDropBehind) throws IOException
IOException
closeReader(boolean)
public StoreFile.Reader createReader() throws IOException
IOException
public StoreFile.Reader createReader(boolean canUseDropBehind) throws IOException
IOException
public StoreFile.Reader getReader()
createReader()
public void closeReader(boolean evictOnClose) throws IOException
evictOnClose
- whether to evict blocks belonging to this fileIOException
public void deleteReader() throws IOException
IOException
public String toStringDetailed()
public static org.apache.hadoop.fs.Path getUniqueFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException
fs
- dir
- Directory to create file in.dir
IOException
public Long getMinimumTimestamp()
byte[] getFileSplitPoint(KeyValue.KVComparator comparator) throws IOException
comparator
- Comparator used to compare KVs.IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.