Class TestChecksum.CorruptedFSReaderImpl

java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestChecksum.CorruptedFSReaderImpl
Enclosing class:
TestChecksum

private static class TestChecksum.CorruptedFSReaderImpl extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    (package private) boolean
    If set to true, corrupt reads using readAtOffset(...).
    static final String
     
    protected final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    CorruptedFSReaderImpl(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 Type
    Method
    Description
    org.apache.hadoop.hbase.io.hfile.HFileBlock.BlockIterator
    blockRange(long arg0, long arg1)
     
    void
     
    org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext
     
    org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext
     
    protected boolean
    readAtOffset(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.HFileBlock
    readBlockData(long arg0, long arg1, boolean arg2, boolean arg3, boolean arg4)
     
    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)
     
    void
    setDataBlockEncoder(org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder arg0, org.apache.hadoop.conf.Configuration arg1)
     
    void
    setIncludesMemStoreTS(boolean arg0)
     
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • corruptDataStream

      If set to true, corrupt reads using readAtOffset(...).
    • hdrSize

      protected final int hdrSize
    • FS_READER_WARN_TIME_MS

      public static final String 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)
    • readBlockData

      public org.apache.hadoop.hbase.io.hfile.HFileBlock readBlockData(long arg0, long arg1, boolean arg2, boolean arg3, boolean arg4) throws IOException
      Throws:
      IOException
    • setIncludesMemStoreTS

      public void setIncludesMemStoreTS(boolean arg0)
    • setDataBlockEncoder

      public void setDataBlockEncoder(org.apache.hadoop.hbase.io.hfile.HFileDataBlockEncoder arg0, org.apache.hadoop.conf.Configuration arg1)
    • getBlockDecodingContext

      public org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext getBlockDecodingContext()
    • getDefaultBlockDecodingContext

      public org.apache.hadoop.hbase.io.encoding.HFileBlockDecodingContext getDefaultBlockDecodingContext()
    • closeStreams

      public void closeStreams() throws IOException
      Throws:
      IOException
    • unbufferStream

      public void unbufferStream()
    • toString

      public String toString()
      Overrides:
      toString in class Object