Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlockIndex
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlockIndex
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classA wrapper around a block reader which only caches the results of the last operation.(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate final org.apache.hadoop.hbase.io.compress.Compression.Algorithmprivate org.apache.hadoop.conf.Configurationprivate static final int[]private byte[]private static org.apache.hadoop.fs.FileSystemprivate static final booleanprivate static final int[]private static final List<byte[]>private static final org.slf4j.Loggerprivate static final intprivate static final intprivate intprivate intprivate org.apache.hadoop.fs.Pathprivate static final Randomprivate longprivate static final intprivate static final HBaseTestingUtilprivate static final int[] -
Constructor Summary
ConstructorsConstructorDescriptionTestHFileBlockIndex(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compr) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidassertArrayEqualsBuffer(String msgPrefix, byte[] arr, ByteBuffer buf) private voidcheckKeyValue(String msgPrefix, byte[] expectedKey, byte[] expectedValue, ByteBuffer keyRead, ByteBuffer valueRead) Check a key/value pair after it was read by the readerprivate voidcheckSeekTo(byte[][] keys, org.apache.hadoop.hbase.io.hfile.HFileScanner scanner, int i) private voidclear()static Collection<Object[]>private static final longgetDummyFileOffset(int i) private static final intgetDummyOnDiskSize(int i) private voidreadIndex(boolean useTags) voidsetUp()voidvoidprivate voidtestBlockIndexInternals(boolean useTags) voidvoidChecks if the HeapSize calculator is within reasonvoidTesting block index through the HFile writer/reader APIs.voidvoidtestIntermediateLevelIndicesWithLargeKeys(int minNumEntries) voidvoidto check if looks good when midKey on a leaf index block boundaryvoidThis test is for HBASE-27940, which midkey metadata in root index block would always be ignored byHFileBlockIndex.BlockIndexReader.readMultiLevelIndexRoot(org.apache.hadoop.hbase.io.hfile.HFileBlock, int).voidprivate voidwriteDataBlocksAndCreateIndex(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, org.apache.hadoop.fs.FSDataOutputStream outputStream, org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexWriter biw) private voidwriteInlineBlocks(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, org.apache.hadoop.fs.FSDataOutputStream outputStream, org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexWriter biw, boolean isClosing) private voidwriteWholeIndex(boolean useTags)
-
Field Details
-
CLASS_RULE
-
LOG
-
RNG
-
NUM_DATA_BLOCKS
- See Also:
-
TEST_UTIL
-
SMALL_BLOCK_SIZE
- See Also:
-
NUM_KV
- See Also:
-
fs
-
path
-
rootIndexOffset
-
numRootEntries
-
numLevels
-
keys
-
compr
-
firstKeyInFile
-
conf
-
INDEX_CHUNK_SIZES
-
EXPECTED_NUM_LEVELS
-
UNCOMPRESSED_INDEX_SIZES
-
includesMemstoreTS
- See Also:
-
-
Constructor Details
-
TestHFileBlockIndex
-
-
Method Details
-
compressionAlgorithms
-
setUp
- Throws:
IOException
-
testBlockIndex
- Throws:
IOException
-
writeDataBlocksAndCreateIndex
private void writeDataBlocksAndCreateIndex(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, org.apache.hadoop.fs.FSDataOutputStream outputStream, org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexWriter biw) throws IOException - Throws:
IOException
-
testBlockIndexWithOffHeapBuffer
- Throws:
Exception
-
clear
- Throws:
IOException
-
testBlockIndexInternals
- Throws:
IOException
-
readIndex
- Throws:
IOException
-
writeWholeIndex
- Throws:
IOException
-
writeInlineBlocks
private void writeInlineBlocks(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer hbw, org.apache.hadoop.fs.FSDataOutputStream outputStream, org.apache.hadoop.hbase.io.hfile.HFileBlockIndex.BlockIndexWriter biw, boolean isClosing) throws IOException - Throws:
IOException
-
getDummyFileOffset
-
getDummyOnDiskSize
-
testSecondaryIndexBinarySearch
- Throws:
IOException
-
testBlockIndexChunk
- Throws:
IOException
-
testHeapSizeForBlockIndex
Checks if the HeapSize calculator is within reason- Throws:
IOException
-
testMidKeyOnLeafIndexBlockBoundary
to check if looks good when midKey on a leaf index block boundary- Throws:
IOException
-
testHFileWriterAndReader
Testing block index through the HFile writer/reader APIs. Allows to test setting index block size through configuration, intermediate-level index blocks, and caching index blocks on write.- Throws:
IOException
-
checkSeekTo
private void checkSeekTo(byte[][] keys, org.apache.hadoop.hbase.io.hfile.HFileScanner scanner, int i) throws IOException - Throws:
IOException
-
assertArrayEqualsBuffer
-
checkKeyValue
private void checkKeyValue(String msgPrefix, byte[] expectedKey, byte[] expectedValue, ByteBuffer keyRead, ByteBuffer valueRead) Check a key/value pair after it was read by the reader -
testIntermediateLevelIndicesWithLargeKeys
- Throws:
IOException
-
testIntermediateLevelIndicesWithLargeKeysWithMinNumEntries
- Throws:
IOException
-
testIntermediateLevelIndicesWithLargeKeys
- Throws:
IOException
-
testMidKeyReadSuccessfullyFromRootIndexBlock
This test is for HBASE-27940, which midkey metadata in root index block would always be ignored byHFileBlockIndex.BlockIndexReader.readMultiLevelIndexRoot(org.apache.hadoop.hbase.io.hfile.HFileBlock, int).- Throws:
IOException
-