static class HFileBlock.FSReaderImpl extends HFileBlock.AbstractFSReader
Modifier and Type | Field and Description |
---|---|
private HFileBlockDefaultDecodingContext |
defaultDecodingCtx
Default context used when BlockType !=
BlockType.ENCODED_DATA . |
private HFileBlockDecodingContext |
encodedBlockDecodingCtx |
private ThreadLocal<HFileBlock.PrefetchedHeader> |
prefetchedHeaderForThread |
protected FSDataInputStreamWrapper |
streamWrapper
The file system stream of the underlying
HFile that
does or doesn't do checksum validations in the filesystem |
DEFAULT_BUFFER_SIZE, fileContext, fileSize, hdrSize, hfs, path, streamLock
Constructor and Description |
---|
HFileBlock.FSReaderImpl(org.apache.hadoop.fs.FSDataInputStream istream,
long fileSize,
HFileContext fileContext)
A constructor that reads files with the latest minor version.
|
HFileBlock.FSReaderImpl(FSDataInputStreamWrapper stream,
long fileSize,
HFileSystem hfs,
org.apache.hadoop.fs.Path path,
HFileContext fileContext) |
Modifier and Type | Method and Description |
---|---|
void |
closeStreams()
Closes the backing streams
|
HFileBlockDecodingContext |
getBlockDecodingContext()
Get a decoder for
BlockType.ENCODED_DATA blocks from this file. |
HFileBlockDecodingContext |
getDefaultBlockDecodingContext()
Get the default decoder for blocks from this file.
|
HFileBlock |
readBlockData(long offset,
long onDiskSizeWithHeaderL,
int uncompressedSize,
boolean pread)
Reads a version 2 block (version 1 blocks not supported and not expected).
|
protected HFileBlock |
readBlockDataInternal(org.apache.hadoop.fs.FSDataInputStream is,
long offset,
int onDiskSizeWithHeader,
int uncompressedSize,
boolean pread,
boolean verifyChecksum)
Reads a version 2 block.
|
(package private) void |
setDataBlockEncoder(HFileDataBlockEncoder encoder) |
(package private) void |
setIncludesMemstoreTS(boolean includesMemstoreTS) |
String |
toString() |
void |
unbufferStream()
To close the stream's socket.
|
protected boolean |
validateChecksum(long offset,
ByteBuffer data,
int hdrSize)
Generates the checksum for the header as well as the data and then validates it.
|
blockRange, readAtOffset
protected FSDataInputStreamWrapper streamWrapper
HFile
that
does or doesn't do checksum validations in the filesystemprivate HFileBlockDecodingContext encodedBlockDecodingCtx
private final HFileBlockDefaultDecodingContext defaultDecodingCtx
BlockType.ENCODED_DATA
.private ThreadLocal<HFileBlock.PrefetchedHeader> prefetchedHeaderForThread
public HFileBlock.FSReaderImpl(FSDataInputStreamWrapper stream, long fileSize, HFileSystem hfs, org.apache.hadoop.fs.Path path, HFileContext fileContext) throws IOException
IOException
HFileBlock.FSReaderImpl(org.apache.hadoop.fs.FSDataInputStream istream, long fileSize, HFileContext fileContext) throws IOException
IOException
public HFileBlock readBlockData(long offset, long onDiskSizeWithHeaderL, int uncompressedSize, boolean pread) throws IOException
offset
- the offset in the stream to read atonDiskSizeWithHeaderL
- the on-disk size of the block, including
the header, or -1 if unknownuncompressedSize
- the uncompressed size of the the block. Always
expected to be -1. This parameter is only used in version 1.pread
- whether to use a positional readIOException
protected HFileBlock readBlockDataInternal(org.apache.hadoop.fs.FSDataInputStream is, long offset, int onDiskSizeWithHeader, int uncompressedSize, boolean pread, boolean verifyChecksum) throws IOException
offset
- the offset in the stream to read atonDiskSizeWithHeader
- the on-disk size of the block, including
the header, or -1 if unknownuncompressedSize
- the uncompressed size of the the block. Always
expected to be -1. This parameter is only used in version 1.pread
- whether to use a positional readverifyChecksum
- Whether to use HBase checksums.
If HBase checksum is switched off, then use HDFS checksum.IOException
void setIncludesMemstoreTS(boolean includesMemstoreTS)
void setDataBlockEncoder(HFileDataBlockEncoder encoder)
public HFileBlockDecodingContext getBlockDecodingContext()
HFileBlock.FSReader
BlockType.ENCODED_DATA
blocks from this file.public HFileBlockDecodingContext getDefaultBlockDecodingContext()
HFileBlock.FSReader
protected boolean validateChecksum(long offset, ByteBuffer data, int hdrSize) throws IOException
IOException
public void closeStreams() throws IOException
HFileBlock.FSReader
IOException
public void unbufferStream()
HFileBlock.FSReader
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.