Package org.apache.hadoop.hbase.io.hfile
Class TestHFileBlockIndex
java.lang.Object
org.apache.hadoop.hbase.io.hfile.TestHFileBlockIndex
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static class
A wrapper around a block reader which only caches the results of the last operation.(package private) static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HBaseClassTestRule
private final org.apache.hadoop.hbase.io.compress.Compression.Algorithm
private org.apache.hadoop.conf.Configuration
private static final int[]
private byte[]
private static org.apache.hadoop.fs.FileSystem
private static final boolean
private static final int[]
private static final List<byte[]>
private static final org.slf4j.Logger
private static final int
private static final int
private int
private int
private org.apache.hadoop.fs.Path
private static final Random
private long
private static final int
private static final HBaseTestingUtility
private static final int[]
-
Constructor Summary
ConstructorDescriptionTestHFileBlockIndex
(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compr) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
assertArrayEqualsBuffer
(String msgPrefix, byte[] arr, ByteBuffer buf) private void
checkKeyValue
(String msgPrefix, byte[] expectedKey, byte[] expectedValue, ByteBuffer keyRead, ByteBuffer valueRead) Check a key/value pair after it was read by the readerprivate void
checkSeekTo
(byte[][] keys, org.apache.hadoop.hbase.io.hfile.HFileScanner scanner, int i) private void
clear()
static Collection<Object[]>
private static final long
getDummyFileOffset
(int i) private static final int
getDummyOnDiskSize
(int i) private void
readIndex
(boolean useTags) void
setUp()
void
void
private void
testBlockIndexInternals
(boolean useTags) void
Checks if the HeapSize calculator is within reasonvoid
Testing block index through the HFile writer/reader APIs.void
void
testIntermediateLevelIndicesWithLargeKeys
(int minNumEntries) void
void
to check if looks good when midKey on a leaf index block boundaryvoid
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)
.void
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) private void
writeWholeIndex
(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
-
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
-