public class TestHFileBlock extends Object
Modifier and Type | Class and Description |
---|---|
private class |
TestHFileBlock.BlockReaderThread |
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.hbase.io.ByteBuffAllocator |
alloc |
private static boolean[] |
BOOLEAN_VALUES |
private static float |
CHANCE_TO_REPEAT |
static HBaseClassTestRule |
CLASS_RULE |
(package private) static org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] |
COMPRESSION_ALGORITHMS |
private static boolean |
detailedLogging |
private static int |
FIELD_LENGTH |
private org.apache.hadoop.fs.FileSystem |
fs |
private boolean |
includesMemstoreTS |
private boolean |
includesTag |
private static org.slf4j.Logger |
LOG |
private static int |
MAX_BUFFER_COUNT |
private static int |
NUM_KEYVALUES |
private static int |
NUM_READER_THREADS |
private static int |
NUM_TEST_BLOCKS |
private static Random |
RNG |
private static HBaseTestingUtility |
TEST_UTIL |
private boolean |
useHeapAllocator |
Constructor and Description |
---|
TestHFileBlock(boolean includesMemstoreTS,
boolean includesTag,
boolean useHeapAllocator) |
Modifier and Type | Method and Description |
---|---|
private void |
assertAllocator() |
(package private) static void |
assertBuffersEqual(org.apache.hadoop.hbase.nio.ByteBuff expectedBuffer,
org.apache.hadoop.hbase.nio.ByteBuff actualBuffer,
org.apache.hadoop.hbase.io.compress.Compression.Algorithm compression,
org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding,
boolean pread) |
private void |
assertRelease(org.apache.hadoop.hbase.io.hfile.HFileBlock blk) |
(package private) static String |
buildMessageDetails(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compression,
org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding,
boolean pread) |
private org.apache.hadoop.hbase.io.ByteBuffAllocator |
createOffHeapAlloc() |
String |
createTestBlockStr(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo,
int correctLength,
boolean useTag) |
byte[] |
createTestV1Block(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo) |
(package private) static org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer |
createTestV2Block(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo,
boolean includesMemstoreTS,
boolean includesTag) |
private Random |
defaultRandom() |
private static String |
nextBytesToStr(org.apache.hadoop.hbase.nio.ByteBuff buf,
int pos)
Convert a few next bytes in the given buffer at the given position to string.
|
static Collection<Object[]> |
parameters() |
void |
setUp() |
void |
tearDown() |
void |
testBlockHeapSize() |
protected void |
testBlockHeapSizeInternals() |
void |
testConcurrentReading() |
protected void |
testConcurrentReadingInternals() |
void |
testDataBlockEncoding()
Test encoding/decoding data blocks.
|
void |
testGzipCompression() |
private void |
testInternals() |
void |
testNoCompression() |
void |
testPreviousOffset() |
protected void |
testPreviousOffsetInternals() |
void |
testReaderV2() |
protected void |
testReaderV2Internals() |
void |
testSerializeWithoutNextBlockMetadata() |
private long |
writeBlocks(org.apache.hadoop.conf.Configuration conf,
Random rand,
org.apache.hadoop.hbase.io.compress.Compression.Algorithm compressAlgo,
org.apache.hadoop.fs.Path path,
List<Long> expectedOffsets,
List<Long> expectedPrevOffsets,
List<org.apache.hadoop.hbase.io.hfile.BlockType> expectedTypes,
List<ByteBuffer> expectedContents) |
(package private) static void |
writeTestBlockContents(DataOutputStream dos) |
(package private) static int |
writeTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw,
int seed,
boolean includesMemstoreTS,
boolean useTag) |
public static final HBaseClassTestRule CLASS_RULE
private static final boolean detailedLogging
private static final boolean[] BOOLEAN_VALUES
private static final org.slf4j.Logger LOG
static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[] COMPRESSION_ALGORITHMS
private static final int NUM_TEST_BLOCKS
private static final int NUM_READER_THREADS
private static final int MAX_BUFFER_COUNT
private static int NUM_KEYVALUES
private static int FIELD_LENGTH
private static float CHANCE_TO_REPEAT
private static final HBaseTestingUtility TEST_UTIL
private org.apache.hadoop.fs.FileSystem fs
private final boolean includesMemstoreTS
private final boolean includesTag
private final boolean useHeapAllocator
private final org.apache.hadoop.hbase.io.ByteBuffAllocator alloc
public TestHFileBlock(boolean includesMemstoreTS, boolean includesTag, boolean useHeapAllocator)
public static Collection<Object[]> parameters()
private org.apache.hadoop.hbase.io.ByteBuffAllocator createOffHeapAlloc()
private void assertAllocator()
public void setUp() throws IOException
IOException
public void tearDown() throws IOException
IOException
static void writeTestBlockContents(DataOutputStream dos) throws IOException
IOException
static int writeTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int seed, boolean includesMemstoreTS, boolean useTag) throws IOException
IOException
public byte[] createTestV1Block(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo) throws IOException
IOException
static org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer createTestV2Block(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo, boolean includesMemstoreTS, boolean includesTag) throws IOException
IOException
public String createTestBlockStr(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo, int correctLength, boolean useTag) throws IOException
IOException
public void testNoCompression() throws IOException
IOException
public void testGzipCompression() throws IOException
IOException
public void testReaderV2() throws IOException
IOException
private void assertRelease(org.apache.hadoop.hbase.io.hfile.HFileBlock blk)
protected void testReaderV2Internals() throws IOException
IOException
public void testDataBlockEncoding() throws IOException
IOException
- a bug or a problem with temporary files.private void testInternals() throws IOException
IOException
static String buildMessageDetails(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compression, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding, boolean pread)
static void assertBuffersEqual(org.apache.hadoop.hbase.nio.ByteBuff expectedBuffer, org.apache.hadoop.hbase.nio.ByteBuff actualBuffer, org.apache.hadoop.hbase.io.compress.Compression.Algorithm compression, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding, boolean pread)
private static String nextBytesToStr(org.apache.hadoop.hbase.nio.ByteBuff buf, int pos)
public void testPreviousOffset() throws IOException
IOException
protected void testPreviousOffsetInternals() throws IOException
IOException
private Random defaultRandom()
public void testConcurrentReading() throws Exception
Exception
protected void testConcurrentReadingInternals() throws IOException, InterruptedException, ExecutionException
private long writeBlocks(org.apache.hadoop.conf.Configuration conf, Random rand, org.apache.hadoop.hbase.io.compress.Compression.Algorithm compressAlgo, org.apache.hadoop.fs.Path path, List<Long> expectedOffsets, List<Long> expectedPrevOffsets, List<org.apache.hadoop.hbase.io.hfile.BlockType> expectedTypes, List<ByteBuffer> expectedContents) throws IOException
IOException
public void testBlockHeapSize()
protected void testBlockHeapSizeInternals()
public void testSerializeWithoutNextBlockMetadata()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.