@InterfaceAudience.Private public class HFileReaderV2 extends AbstractHFileReader
HFile reader for version 2.| Modifier and Type | Class and Description |
|---|---|
protected static class |
HFileReaderV2.AbstractScannerV2 |
protected static class |
HFileReaderV2.EncodedScannerV2
ScannerV2 that operates on encoded data blocks.
|
protected static class |
HFileReaderV2.ScannerV2
Implementation of
HFileScanner interface. |
AbstractHFileReader.BlockIndexNotLoadedException, AbstractHFileReader.NotSeekedException, AbstractHFileReader.Scanner| Modifier and Type | Field and Description |
|---|---|
protected boolean |
decodeMemstoreTS |
protected HFileBlock.FSReader |
fsBlockReader
Filesystem-level block reader.
|
protected HFileContext |
hfileContext |
protected boolean |
includesMemstoreTS |
static int |
KEY_VALUE_LEN_SIZE
The size of a (key length, value length) tuple that prefixes each entry in
a data block.
|
static int |
MINOR_VERSION_NO_CHECKSUM
In HFile V2 minor version that does not support checksums
|
static int |
MINOR_VERSION_WITH_CHECKSUM
Minor versions in HFile V2 starting with this number have hbase checksums
|
static int |
PBUF_TRAILER_MINOR_VERSION
HFile minor version that introduced pbuf filetrailer
|
avgKeyLen, avgValueLen, cacheConf, comparator, compressAlgo, conf, dataBlockEncoder, dataBlockIndexReader, fileInfo, fileSize, hfs, istream, istreamNoFsChecksum, lastKey, metaBlockIndexReader, name, path, trailer| Constructor and Description |
|---|
HFileReaderV2(org.apache.hadoop.fs.Path path,
FixedFileTrailer trailer,
FSDataInputStreamWrapper fsdis,
long size,
CacheConfig cacheConf,
HFileSystem hfs,
org.apache.hadoop.conf.Configuration conf)
Opens a HFile.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
close(boolean evictOnClose)
Close method with optional evictOnClose
|
protected HFileContext |
createHFileContext(FSDataInputStreamWrapper fsdis,
long fileSize,
HFileSystem hfs,
org.apache.hadoop.fs.Path path,
FixedFileTrailer trailer) |
DataInput |
getDeleteBloomFilterMetadata()
Retrieves delete family Bloom filter metadata as appropriate for each
HFile version. |
HFileContext |
getFileContext()
Return the file context of the HFile this reader belongs to
|
DataInput |
getGeneralBloomFilterMetadata()
Returns a buffer with the Bloom filter metadata.
|
byte[] |
getLastKey() |
int |
getMajorVersion() |
ByteBuffer |
getMetaBlock(String metaBlockName,
boolean cacheBlock) |
HFileScanner |
getScanner(boolean cacheBlocks,
boolean pread,
boolean isCompaction)
Create a Scanner on this file.
|
boolean |
hasMVCCInfo() |
boolean |
isFileInfoLoaded() |
byte[] |
midkey() |
HFileBlock |
readBlock(long dataBlockOffset,
long onDiskBlockSize,
boolean cacheBlock,
boolean pread,
boolean isCompaction,
boolean updateCacheMetrics,
BlockType expectedBlockType)
Read in a file block.
|
protected boolean |
shouldIncludeMemstoreTS() |
getComparator, getCompressionAlgorithm, getConf, getDataBlockEncoding, getDataBlockIndexReader, getEntries, getFirstKey, getFirstRowKey, getLastRowKey, getName, getPath, getScanner, getTrailer, indexSize, length, loadFileInfo, setConf, toString, toStringFirstKey, toStringLastKeypublic static final int MINOR_VERSION_WITH_CHECKSUM
public static final int MINOR_VERSION_NO_CHECKSUM
public static final int PBUF_TRAILER_MINOR_VERSION
public static final int KEY_VALUE_LEN_SIZE
protected boolean includesMemstoreTS
protected boolean decodeMemstoreTS
protected HFileBlock.FSReader fsBlockReader
protected HFileContext hfileContext
public HFileReaderV2(org.apache.hadoop.fs.Path path,
FixedFileTrailer trailer,
FSDataInputStreamWrapper fsdis,
long size,
CacheConfig cacheConf,
HFileSystem hfs,
org.apache.hadoop.conf.Configuration conf)
throws IOException
AbstractHFileReader.loadFileInfo().path - Path to HFile.trailer - File trailer.fsdis - input stream.size - Length of the stream.cacheConf - Cache configuration.hfs - conf - IOExceptionprotected boolean shouldIncludeMemstoreTS()
protected HFileContext createHFileContext(FSDataInputStreamWrapper fsdis, long fileSize, HFileSystem hfs, org.apache.hadoop.fs.Path path, FixedFileTrailer trailer) throws IOException
IOExceptionpublic HFileScanner getScanner(boolean cacheBlocks, boolean pread, boolean isCompaction)
HFileScanner.seekTo(byte[]) to position an start the read. There is
nothing to clean up in a Scanner. Letting go of your references to the
scanner is sufficient.cacheBlocks - True if we should cache blocks read in by this scanner.pread - Use positional read rather than seek+read if true (pread is
better for random reads, seek+read is better scanning).isCompaction - is scanner being used for a compaction?public ByteBuffer getMetaBlock(String metaBlockName, boolean cacheBlock) throws IOException
metaBlockName - cacheBlock - Add block to cache, if foundIOExceptionpublic HFileBlock readBlock(long dataBlockOffset, long onDiskBlockSize, boolean cacheBlock, boolean pread, boolean isCompaction, boolean updateCacheMetrics, BlockType expectedBlockType) throws IOException
dataBlockOffset - offset to read.onDiskBlockSize - size of the blockcacheBlock - pread - Use positional read instead of seek+read (positional is
better doing random reads whereas seek+read is better scanning).isCompaction - is this block being read as part of a compactionexpectedBlockType - the block type we are expecting to read with this
read operation, or null to read whatever block type is available
and avoid checking (that might reduce caching efficiency of
encoded data blocks)IOExceptionpublic boolean hasMVCCInfo()
public byte[] getLastKey()
public byte[] midkey()
throws IOException
IOExceptionpublic void close()
throws IOException
IOExceptionpublic void close(boolean evictOnClose)
throws IOException
HFile.ReaderIOExceptionpublic DataInput getGeneralBloomFilterMetadata() throws IOException
IOExceptionpublic DataInput getDeleteBloomFilterMetadata() throws IOException
HFile.ReaderHFile version.
Knows nothing about how that metadata is structured.IOExceptionpublic boolean isFileInfoLoaded()
isFileInfoLoaded in class AbstractHFileReaderpublic int getMajorVersion()
getMajorVersion in class AbstractHFileReaderpublic HFileContext getFileContext()
HFile.ReaderCopyright © 2014 The Apache Software Foundation. All rights reserved.