Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlockUnpack
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlockUnpack
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.apache.hadoop.hbase.io.ByteBuffAllocatorprivate static floatstatic final HBaseClassTestRuleprivate org.apache.hadoop.fs.FileSystemprivate static final intorg.junit.rules.TestNameprivate static final HBaseTestingUtility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertBuffersEqual(org.apache.hadoop.hbase.nio.ByteBuff bufferOne, org.apache.hadoop.hbase.nio.ByteBuff bufferTwo, int expectedSize) private intcreateTestBlock(org.apache.hadoop.fs.Path path) voidIt's important that if you read and unpack the same HFileBlock twice, it results in an identical buffer each time.voidIf the block on disk size is less thanByteBuffAllocator's min allocation size, that block will be allocated to heap regardless of desire for off-heap.private static intmaybeIncrement(Random random, int value) readBlock(org.apache.hadoop.fs.Path path, int totalSize) voidsetUp()(package private) static intwriteTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int desiredSize)
-
Field Details
-
CLASS_RULE
-
TEST_UTIL
-
CHANCE_TO_REPEAT
-
MIN_ALLOCATION_SIZE
- See Also:
-
allocator
org.apache.hadoop.hbase.io.ByteBuffAllocator allocator -
name
-
fs
-
-
Constructor Details
-
TestHFileBlockUnpack
public TestHFileBlockUnpack()
-
-
Method Details
-
setUp
- Throws:
Exception
-
itUnpacksIdenticallyEachTime
It's important that if you read and unpack the same HFileBlock twice, it results in an identical buffer each time. Otherwise we end up with validation failures in block cache, since contents may not match if the same block is cached twice. See https://issues.apache.org/jira/browse/HBASE-27053- Throws:
IOException
-
assertBuffersEqual
private void assertBuffersEqual(org.apache.hadoop.hbase.nio.ByteBuff bufferOne, org.apache.hadoop.hbase.nio.ByteBuff bufferTwo, int expectedSize) -
readBlock
private TestHFileBlockUnpack.HFileBlockWrapper readBlock(org.apache.hadoop.fs.Path path, int totalSize) throws IOException - Throws:
IOException
-
createTestBlock
- Throws:
IOException
-
writeTestKeyValues
static int writeTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int desiredSize) throws IOException - Throws:
IOException
-
maybeIncrement
-