Class TestDataBlockEncoders
java.lang.Object
org.apache.hadoop.hbase.io.encoding.TestDataBlockEncoders
Test all of the data block encoding algorithms for correctness. Most of the class generate data
which will test different branches in code.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private final org.apache.hadoop.conf.Configuration
private static int
private final RedundantKVGenerator
(package private) static final byte[]
private final boolean
private final boolean
private static final org.slf4j.Logger
private static int
private static int
private final boolean
-
Constructor Summary
ConstructorDescriptionTestDataBlockEncoders
(boolean includesMemstoreTS, boolean includesTag, boolean useOffheapData) -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hadoop.hbase.ByteBufferKeyValue
buildOffHeapKeyValue
(org.apache.hadoop.hbase.KeyValue keyValue) private void
checkSeekingConsistency
(List<org.apache.hadoop.hbase.io.encoding.DataBlockEncoder.EncodedSeeker> encodedSeekers, boolean seekBefore, org.apache.hadoop.hbase.ExtendedCell keyValue) (package private) static ByteBuffer
encodeKeyValues
(org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding, List<org.apache.hadoop.hbase.KeyValue> kvs, org.apache.hadoop.hbase.io.encoding.HFileBlockEncodingContext encodingContext, boolean useOffheapData) private org.apache.hadoop.hbase.io.encoding.HFileBlockEncodingContext
getEncodingContext
(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding) static Collection<Object[]>
private void
testAlgorithm
(byte[] encodedData, ByteBuffer unencodedDataBuf, org.apache.hadoop.hbase.io.encoding.DataBlockEncoder encoder) void
Test data block encoding of empty KeyValue.private void
testEncodersOnDataset
(List<org.apache.hadoop.hbase.KeyValue> kvList, boolean includesMemstoreTS, boolean includesTags) void
Test whether compression -> decompression gives the consistent results on pseudorandom sample.void
Test whether the decompression of first key is implemented correctly.void
Test KeyValues with negative timestamp.void
void
void
Test seeking while file is encoded.void
void
-
Field Details
-
CLASS_RULE
-
LOG
-
NUMBER_OF_KV
-
NUM_RANDOM_SEEKS
-
ENCODED_DATA_OFFSET
-
HFILEBLOCK_DUMMY_HEADER
-
conf
-
generator
-
includesMemstoreTS
-
includesTags
-
useOffheapData
-
-
Constructor Details
-
TestDataBlockEncoders
public TestDataBlockEncoders(boolean includesMemstoreTS, boolean includesTag, boolean useOffheapData)
-
-
Method Details
-
parameters
-
getEncodingContext
private org.apache.hadoop.hbase.io.encoding.HFileBlockEncodingContext getEncodingContext(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.io.compress.Compression.Algorithm algo, org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding) -
testEmptyKeyValues
Test data block encoding of empty KeyValue. On test failure.- Throws:
IOException
-
testNegativeTimestamps
Test KeyValues with negative timestamp. On test failure.- Throws:
IOException
-
testExecutionOnSample
Test whether compression -> decompression gives the consistent results on pseudorandom sample.- Throws:
IOException
- On test failure.
-
testSeekingOnSample
Test seeking while file is encoded.- Throws:
IOException
-
testSeekingToOffHeapKeyValueInSample
- Throws:
IOException
-
encodeKeyValues
static ByteBuffer encodeKeyValues(org.apache.hadoop.hbase.io.encoding.DataBlockEncoding encoding, List<org.apache.hadoop.hbase.KeyValue> kvs, org.apache.hadoop.hbase.io.encoding.HFileBlockEncodingContext encodingContext, boolean useOffheapData) throws IOException - Throws:
IOException
-
testNextOnSample
- Throws:
IOException
-
testFirstKeyInBlockOnSample
Test whether the decompression of first key is implemented correctly.- Throws:
IOException
-
testRowIndexWithTagsButNoTagsInCell
- Throws:
IOException
-
checkSeekingConsistency
private void checkSeekingConsistency(List<org.apache.hadoop.hbase.io.encoding.DataBlockEncoder.EncodedSeeker> encodedSeekers, boolean seekBefore, org.apache.hadoop.hbase.ExtendedCell keyValue) -
testEncodersOnDataset
private void testEncodersOnDataset(List<org.apache.hadoop.hbase.KeyValue> kvList, boolean includesMemstoreTS, boolean includesTags) throws IOException - Throws:
IOException
-
testZeroByte
- Throws:
IOException
-
testAlgorithm
private void testAlgorithm(byte[] encodedData, ByteBuffer unencodedDataBuf, org.apache.hadoop.hbase.io.encoding.DataBlockEncoder encoder) throws IOException - Throws:
IOException
-
buildOffHeapKeyValue
private static org.apache.hadoop.hbase.ByteBufferKeyValue buildOffHeapKeyValue(org.apache.hadoop.hbase.KeyValue keyValue) throws IOException - Throws:
IOException
-