Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlockUnpack
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlockUnpack
@Tag("org.apache.hadoop.hbase.testclassification.IOTests") @Tag("org.apache.hadoop.hbase.testclassification.MediumTests")
public class TestHFileBlockUnpack
extends Object
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.apache.hadoop.hbase.io.ByteBuffAllocatorprivate static floatprivate org.apache.hadoop.fs.FileSystemprivate static final intprivate static final HBaseTestingUtil -
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) voiditUnpacksIdenticallyEachTime(org.junit.jupiter.api.TestInfo testInfo) It's important that if you read and unpack the same HFileBlock twice, it results in an identical buffer each time.voiditUsesSharedMemoryIfUnpackedBlockExceedsMinAllocationSize(org.junit.jupiter.api.TestInfo testInfo) 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 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
-
TEST_UTIL
-
CHANCE_TO_REPEAT
-
MIN_ALLOCATION_SIZE
- See Also:
-
allocator
org.apache.hadoop.hbase.io.ByteBuffAllocator allocator -
fs
-
-
Constructor Details
-
TestHFileBlockUnpack
public TestHFileBlockUnpack()
-
-
Method Details
-
setUp
- Throws:
Exception
-
itUnpacksIdenticallyEachTime
@Test public void itUnpacksIdenticallyEachTime(org.junit.jupiter.api.TestInfo testInfo) throws IOException 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
-