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
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate final org.apache.hadoop.conf.Configurationprivate static intprivate final RedundantKVGenerator(package private) static final byte[]private final booleanprivate final booleanprivate static final org.slf4j.Loggerprivate static intprivate static intprivate final boolean -
Constructor Summary
ConstructorsConstructorDescriptionTestDataBlockEncoders(boolean includesMemstoreTS, boolean includesTag, boolean useOffheapData) -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hadoop.hbase.ByteBufferKeyValuebuildOffHeapKeyValue(org.apache.hadoop.hbase.KeyValue keyValue) private voidcheckSeekingConsistency(List<org.apache.hadoop.hbase.io.encoding.DataBlockEncoder.EncodedSeeker> encodedSeekers, boolean seekBefore, org.apache.hadoop.hbase.Cell keyValue) (package private) static ByteBufferencodeKeyValues(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.HFileBlockEncodingContextgetEncodingContext(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 voidtestAlgorithm(byte[] encodedData, ByteBuffer unencodedDataBuf, org.apache.hadoop.hbase.io.encoding.DataBlockEncoder encoder) voidTest data block encoding of empty KeyValue.private voidtestEncodersOnDataset(List<org.apache.hadoop.hbase.KeyValue> kvList, boolean includesMemstoreTS, boolean includesTags) voidTest whether compression -> decompression gives the consistent results on pseudorandom sample.voidTest whether the decompression of first key is implemented correctly.voidTest KeyValues with negative timestamp.voidvoidvoidTest seeking while file is encoded.voidvoid
-
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.Cell 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
-