Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlockUnpack
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlockUnpack
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static final class
-
Field Summary
Modifier and TypeFieldDescription(package private) org.apache.hadoop.hbase.io.ByteBuffAllocator
private static float
static final HBaseClassTestRule
private org.apache.hadoop.fs.FileSystem
private static final int
org.junit.rules.TestName
private static final HBaseTestingUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate void
assertBuffersEqual
(org.apache.hadoop.hbase.nio.ByteBuff bufferOne, org.apache.hadoop.hbase.nio.ByteBuff bufferTwo, int expectedSize) private int
createTestBlock
(org.apache.hadoop.fs.Path path) void
It's important that if you read and unpack the same HFileBlock twice, it results in an identical buffer each time.void
If 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 int
maybeIncrement
(Random random, int value) readBlock
(org.apache.hadoop.fs.Path path, int totalSize) void
setUp()
(package private) static int
writeTestKeyValues
(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
-