Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlock
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlock
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hadoop.hbase.io.ByteBuffAllocator
private static final boolean[]
private static float
static final HBaseClassTestRule
(package private) static final org.apache.hadoop.hbase.io.compress.Compression.Algorithm[]
private static final boolean
private static int
private org.apache.hadoop.fs.FileSystem
private final boolean
private final boolean
private static final org.slf4j.Logger
private static final int
private static int
private static final int
private static final int
private static final Random
private static final HBaseTestingUtil
private final boolean
-
Constructor Summary
ConstructorDescriptionTestHFileBlock
(boolean includesMemstoreTS, boolean includesTag, boolean useHeapAllocator) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
(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
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
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[]>
void
setUp()
void
tearDown()
void
protected void
void
protected void
void
Test encoding/decoding data blocks.void
private void
void
void
protected void
void
protected void
void
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
(package private) static int
writeTestKeyValues
(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int seed, boolean includesMemstoreTS, boolean useTag)
-
Field Details
-
CLASS_RULE
-
detailedLogging
- See Also:
-
BOOLEAN_VALUES
-
LOG
-
COMPRESSION_ALGORITHMS
-
NUM_TEST_BLOCKS
- See Also:
-
NUM_READER_THREADS
- See Also:
-
MAX_BUFFER_COUNT
- See Also:
-
NUM_KEYVALUES
-
FIELD_LENGTH
-
CHANCE_TO_REPEAT
-
TEST_UTIL
-
RNG
-
fs
-
includesMemstoreTS
-
includesTag
-
useHeapAllocator
-
alloc
-
-
Constructor Details
-
TestHFileBlock
-
-
Method Details
-
parameters
-
createOffHeapAlloc
-
assertAllocator
-
setUp
- Throws:
IOException
-
tearDown
- Throws:
IOException
-
writeTestBlockContents
- Throws:
IOException
-
writeTestKeyValues
static int writeTestKeyValues(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, int seed, boolean includesMemstoreTS, boolean useTag) throws IOException - Throws:
IOException
-
createTestV1Block
public byte[] createTestV1Block(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo) throws IOException - Throws:
IOException
-
createTestV2Block
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 - Throws:
IOException
-
createTestBlockStr
public String createTestBlockStr(org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo, int correctLength, boolean useTag) throws IOException - Throws:
IOException
-
testNoCompression
- Throws:
IOException
-
testGzipCompression
- Throws:
IOException
-
testReaderV2
- Throws:
IOException
-
assertRelease
-
testReaderV2Internals
- Throws:
IOException
-
testDataBlockEncoding
Test encoding/decoding data blocks.- Throws:
IOException
- a bug or a problem with temporary files.
-
testInternals
- Throws:
IOException
-
buildMessageDetails
static String buildMessageDetails(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compression, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding, boolean pread) -
assertBuffersEqual
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) -
nextBytesToStr
Convert a few next bytes in the given buffer at the given position to string. Used for error messages. -
testPreviousOffset
- Throws:
IOException
-
testPreviousOffsetInternals
- Throws:
IOException
-
defaultRandom
-
testConcurrentReading
- Throws:
Exception
-
testConcurrentReadingInternals
protected void testConcurrentReadingInternals() throws IOException, InterruptedException, ExecutionException -
writeBlocks
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 - Throws:
IOException
-
testBlockHeapSize
-
testBlockHeapSizeInternals
-
testSerializeWithoutNextBlockMetadata
-