Package org.apache.hadoop.hbase.io.hfile
Class TestChecksum.CorruptedFSReaderImpl
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestChecksum.CorruptedFSReaderImpl
- All Implemented Interfaces:
org.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
- Enclosing class:
- TestChecksum
This class is to test checksum behavior when data is corrupted. It mimics the following
behavior: - When fs checksum is disabled, hbase may get corrupted data from hdfs. If
verifyChecksum is true, it means hbase checksum is on and fs checksum is off, so we corrupt the
data. - When fs checksum is enabled, hdfs will get a different copy from another node, and will
always return correct data. So we don't corrupt the data when verifyChecksum for hbase is off.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanIf set to true, corrupt reads using readAtOffset(...).static final Stringprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionCorruptedFSReaderImpl(org.apache.hadoop.hbase.io.hfile.ReaderContext context, org.apache.hadoop.hbase.io.hfile.HFileContext meta, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hbase.io.hfile.HFileBlock.BlockIteratorblockRange(long arg0, long arg1) voidorg.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContextorg.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContextprotected booleanreadAtOffset(org.apache.hadoop.fs.FSDataInputStream istream, org.apache.hadoop.hbase.nio.ByteBuff dest, int size, boolean peekIntoNextBlock, long fileOffset, boolean pread) org.apache.hadoop.hbase.io.hfile.HFileBlockreadBlockData(long arg0, long arg1, boolean arg2, boolean arg3, boolean arg4) protected org.apache.hadoop.hbase.io.hfile.HFileBlockreadBlockDataInternal(org.apache.hadoop.fs.FSDataInputStream is, long offset, long onDiskSizeWithHeaderL, boolean pread, boolean verifyChecksum, boolean updateMetrics, boolean useHeap) voidsetDataBlockEncoder(org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder arg0, org.apache.hadoop.conf.Configuration arg1) voidsetIncludesMemStoreTS(boolean arg0) toString()void
-
Field Details
-
corruptDataStream
boolean corruptDataStreamIf set to true, corrupt reads using readAtOffset(...). -
hdrSize
protected final int hdrSize -
FS_READER_WARN_TIME_MS
- See Also:
-
-
Constructor Details
-
CorruptedFSReaderImpl
public CorruptedFSReaderImpl(org.apache.hadoop.hbase.io.hfile.ReaderContext context, org.apache.hadoop.hbase.io.hfile.HFileContext meta, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
-
Method Details
-
readBlockDataInternal
protected org.apache.hadoop.hbase.io.hfile.HFileBlock readBlockDataInternal(org.apache.hadoop.fs.FSDataInputStream is, long offset, long onDiskSizeWithHeaderL, boolean pread, boolean verifyChecksum, boolean updateMetrics, boolean useHeap) throws IOException - Throws:
IOException
-
readAtOffset
protected boolean readAtOffset(org.apache.hadoop.fs.FSDataInputStream istream, org.apache.hadoop.hbase.nio.ByteBuff dest, int size, boolean peekIntoNextBlock, long fileOffset, boolean pread) throws IOException - Throws:
IOException
-
blockRange
public org.apache.hadoop.hbase.io.hfile.HFileBlock.BlockIterator blockRange(long arg0, long arg1) - Specified by:
blockRangein interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
readBlockData
public org.apache.hadoop.hbase.io.hfile.HFileBlock readBlockData(long arg0, long arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException - Specified by:
readBlockDatain interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader- Throws:
IOException
-
setIncludesMemStoreTS
public void setIncludesMemStoreTS(boolean arg0) - Specified by:
setIncludesMemStoreTSin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
setDataBlockEncoder
public void setDataBlockEncoder(org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder arg0, org.apache.hadoop.conf.Configuration arg1) - Specified by:
setDataBlockEncoderin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
getBlockDecodingContext
public org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext getBlockDecodingContext()- Specified by:
getBlockDecodingContextin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
getDefaultBlockDecodingContext
public org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext getDefaultBlockDecodingContext()- Specified by:
getDefaultBlockDecodingContextin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
closeStreams
- Specified by:
closeStreamsin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader- Throws:
IOException
-
unbufferStream
public void unbufferStream()- Specified by:
unbufferStreamin interfaceorg.apache.hadoop.hbase.io.hfile.HFileBlock.FSReader
-
toString
-