public class TestHFileBlockUnpack extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
TestHFileBlockUnpack.HFileBlockWrapper |
Modifier and Type | Field and Description |
---|---|
(package private) org.apache.hadoop.hbase.io.ByteBuffAllocator |
allocator |
private static float |
CHANCE_TO_REPEAT |
static HBaseClassTestRule |
CLASS_RULE |
private org.apache.hadoop.fs.FileSystem |
fs |
private static int |
MIN_ALLOCATION_SIZE |
org.junit.rules.TestName |
name |
private static HBaseTestingUtility |
TEST_UTIL |
Constructor and Description |
---|
TestHFileBlockUnpack() |
Modifier and Type | Method and Description |
---|---|
private 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 |
itUnpacksIdenticallyEachTime()
It's important that if you read and unpack the same HFileBlock twice, it results in an
identical buffer each time.
|
void |
itUsesSharedMemoryIfUnpackedBlockExceedsMinAllocationSize()
If the block on disk size is less than
ByteBuffAllocator '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) |
private TestHFileBlockUnpack.HFileBlockWrapper |
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) |
public static final HBaseClassTestRule CLASS_RULE
private static final HBaseTestingUtility TEST_UTIL
private static float CHANCE_TO_REPEAT
private static final int MIN_ALLOCATION_SIZE
org.apache.hadoop.hbase.io.ByteBuffAllocator allocator
public org.junit.rules.TestName name
private org.apache.hadoop.fs.FileSystem fs
public TestHFileBlockUnpack()
public void itUnpacksIdenticallyEachTime() throws IOException
IOException
private void assertBuffersEqual(org.apache.hadoop.hbase.nio.ByteBuff bufferOne, org.apache.hadoop.hbase.nio.ByteBuff bufferTwo, int expectedSize)
public void itUsesSharedMemoryIfUnpackedBlockExceedsMinAllocationSize() throws IOException
ByteBuffAllocator
's min allocation size, that
block will be allocated to heap regardless of desire for off-heap. After de-compressing the
block, the new size may now exceed the min allocation size. This test ensures that those
de-compressed blocks, which will be allocated off-heap, are properly marked as
HFileBlock.isSharedMem()
== true See https://issues.apache.org/jira/browse/HBASE-27170IOException
private TestHFileBlockUnpack.HFileBlockWrapper readBlock(org.apache.hadoop.fs.Path path, int totalSize) throws IOException
IOException
private int createTestBlock(org.apache.hadoop.fs.Path path) throws IOException
IOException
static int writeTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int desiredSize) throws IOException
IOException
private static int maybeIncrement(Random random, int value)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.