public class TestHFileBlockIndex extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
TestHFileBlockIndex.BlockReaderWrapper
A wrapper around a block reader which only caches the results of the last
operation.
|
Modifier and Type | Field and Description |
---|---|
static HBaseClassTestRule |
CLASS_RULE |
private org.apache.hadoop.hbase.io.compress.Compression.Algorithm |
compr |
private org.apache.hadoop.conf.Configuration |
conf |
private static int[] |
EXPECTED_NUM_LEVELS |
private byte[] |
firstKeyInFile |
private static org.apache.hadoop.fs.FileSystem |
fs |
private static boolean |
includesMemstoreTS |
private static int[] |
INDEX_CHUNK_SIZES |
private static List<byte[]> |
keys |
private static org.slf4j.Logger |
LOG |
private static int |
NUM_DATA_BLOCKS |
private static int |
NUM_KV |
private int |
numLevels |
private int |
numRootEntries |
private org.apache.hadoop.fs.Path |
path |
private Random |
rand |
private long |
rootIndexOffset |
private static int |
SMALL_BLOCK_SIZE |
private static HBaseTestingUtility |
TEST_UTIL |
private static int[] |
UNCOMPRESSED_INDEX_SIZES |
Constructor and Description |
---|
TestHFileBlockIndex(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compr) |
Modifier and Type | Method and Description |
---|---|
private 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 reader
|
private void |
checkSeekTo(byte[][] keys,
org.apache.hadoop.hbase.io.hfile.HFileScanner scanner,
int i) |
private void |
clear() |
static Collection<Object[]> |
compressionAlgorithms() |
private static long |
getDummyFileOffset(int i) |
private static int |
getDummyOnDiskSize(int i) |
private void |
readIndex(boolean useTags) |
void |
setUp() |
void |
testBlockIndex() |
void |
testBlockIndexChunk() |
private void |
testBlockIndexInternals(boolean useTags) |
void |
testHeapSizeForBlockIndex()
Checks if the HeapSize calculator is within reason
|
void |
testHFileWriterAndReader()
Testing block index through the HFile writer/reader APIs.
|
void |
testIntermediateLevelIndicesWithLargeKeys() |
void |
testIntermediateLevelIndicesWithLargeKeys(int minNumEntries) |
void |
testIntermediateLevelIndicesWithLargeKeysWithMinNumEntries() |
void |
testMidKeyOnLeafIndexBlockBoundary()
to check if looks good when midKey on a leaf index block boundary
|
void |
testSecondaryIndexBinarySearch() |
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) |
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static final int NUM_DATA_BLOCKS
private static final HBaseTestingUtility TEST_UTIL
private static final int SMALL_BLOCK_SIZE
private static final int NUM_KV
private static org.apache.hadoop.fs.FileSystem fs
private org.apache.hadoop.fs.Path path
private long rootIndexOffset
private int numRootEntries
private int numLevels
private final org.apache.hadoop.hbase.io.compress.Compression.Algorithm compr
private byte[] firstKeyInFile
private org.apache.hadoop.conf.Configuration conf
private static final int[] INDEX_CHUNK_SIZES
private static final int[] EXPECTED_NUM_LEVELS
private static final int[] UNCOMPRESSED_INDEX_SIZES
private static final boolean includesMemstoreTS
public TestHFileBlockIndex(org.apache.hadoop.hbase.io.compress.Compression.Algorithm compr)
public static Collection<Object[]> compressionAlgorithms()
public void setUp() throws IOException
IOException
public void testBlockIndex() throws IOException
IOException
private void clear() throws IOException
IOException
private void testBlockIndexInternals(boolean useTags) throws IOException
IOException
private void readIndex(boolean useTags) throws IOException
IOException
private void writeWholeIndex(boolean useTags) throws IOException
IOException
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
IOException
private static final long getDummyFileOffset(int i)
private static final int getDummyOnDiskSize(int i)
public void testSecondaryIndexBinarySearch() throws IOException
IOException
public void testBlockIndexChunk() throws IOException
IOException
public void testHeapSizeForBlockIndex() throws IOException
IOException
public void testMidKeyOnLeafIndexBlockBoundary() throws IOException
IOException
public void testHFileWriterAndReader() throws IOException
IOException
private void checkSeekTo(byte[][] keys, org.apache.hadoop.hbase.io.hfile.HFileScanner scanner, int i) throws IOException
IOException
private void assertArrayEqualsBuffer(String msgPrefix, byte[] arr, ByteBuffer buf)
private void checkKeyValue(String msgPrefix, byte[] expectedKey, byte[] expectedValue, ByteBuffer keyRead, ByteBuffer valueRead)
public void testIntermediateLevelIndicesWithLargeKeys() throws IOException
IOException
public void testIntermediateLevelIndicesWithLargeKeysWithMinNumEntries() throws IOException
IOException
public void testIntermediateLevelIndicesWithLargeKeys(int minNumEntries) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.