Class TestStripeCompactionPolicy
java.lang.Object
org.apache.hadoop.hbase.regionserver.compactions.TestStripeCompactionPolicy
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleprivate static final intprivate static floatprivate static longprivate static longprivate static final byte[]private static final byte[]private static final byte[]private static final byte[]private static final byte[]private static final org.apache.hadoop.hbase.KeyValueprivate static final org.apache.hadoop.hbase.KeyValueprivate static final org.apache.hadoop.hbase.KeyValueprivate static final org.apache.hadoop.hbase.KeyValueprivate static final org.apache.hadoop.hbase.KeyValueboolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ArrayList<org.apache.hadoop.hbase.regionserver.HStoreFile>al(org.apache.hadoop.hbase.regionserver.HStoreFile... sfs) private static List<byte[]>createBoundaries(int stripeCount) private org.apache.hadoop.hbase.regionserver.compactions.StripeCompactorprivate static org.apache.hadoop.hbase.regionserver.HStoreFileprivate static org.apache.hadoop.hbase.regionserver.HStoreFilecreateFile(long size) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicycreatePolicy(org.apache.hadoop.conf.Configuration conf) HELPER METHODSprivate static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicycreatePolicy(org.apache.hadoop.conf.Configuration conf, long splitSize, float splitCount, int initialCount, boolean hasTtl) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripes(int l0Count, byte[]... boundaries) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProviderprivate static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripesL0Only(int l0Count, long l0Size) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripesWithFiles(List<byte[]> boundaries, List<List<org.apache.hadoop.hbase.regionserver.HStoreFile>> stripeFiles, List<org.apache.hadoop.hbase.regionserver.HStoreFile> l0Files) This method actually does all the work.private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripesWithFiles(List<org.apache.hadoop.hbase.regionserver.HStoreFile>... stripeFiles) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripesWithSizes(int l0Count, long l0Size, Long[]... sizes) private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvidercreateStripesWithSizes(int l0Count, long l0Size, List<List<Long>> sizes) data()private byte[]dropDeletesMatcher(Boolean dropDeletes, byte[] value) private static List<org.apache.hadoop.hbase.regionserver.HStoreFile>getAllFiles(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int fromStripe, int toStripe) private static voidsetFileStripe(org.apache.hadoop.hbase.regionserver.HStoreFile sf, byte[] startKey, byte[] endKey) voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidprivate voidverifyCollectionsEqual(Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> scr) private voidverifyCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, byte[] dropDeletesFrom, byte[] dropDeletesTo, List<byte[]> boundaries) Verify arbitrary compaction.private voidverifyCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, Boolean dropDeletes, Integer count, Long size, byte[] start, byte[] end, boolean needsCompaction) Verify arbitrary compaction.protected voidverifyFlush(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, org.apache.hadoop.hbase.KeyValue[] input, org.apache.hadoop.hbase.KeyValue[][] expected, byte[][] boundaries) Verify arbitrary flush.private voidverifyMergeCompatcion(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to) private voidverifyNoCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si) Verify no compaction is needed or selected.private voidverifySingleStripeCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int index, Boolean dropDeletes) private voidverifyWholeStripesCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to, Boolean dropDeletes, Integer count, Long size) private voidverifyWholeStripesCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to, Boolean dropDeletes, Integer count, Long size, boolean needsCompaction) Verify the compaction that includes several entire stripes.
-
Field Details
-
CLASS_RULE
-
KEY_A
-
KEY_B
-
KEY_C
-
KEY_D
-
KEY_E
-
KV_A
-
KV_B
-
KV_C
-
KV_D
-
KV_E
-
defaultSplitSize
-
defaultSplitCount
-
defaultInitialCount
- See Also:
-
defaultTtl
-
usePrivateReaders
-
-
Constructor Details
-
TestStripeCompactionPolicy
public TestStripeCompactionPolicy()
-
-
Method Details
-
data
-
testNoStripesFromFlush
- Throws:
Exception
-
testOldStripesFromFlush
- Throws:
Exception
-
testNewStripesFromFlush
- Throws:
Exception
-
testSingleStripeCompaction
- Throws:
Exception
-
testWithParallelCompaction
- Throws:
Exception
-
testWithReferences
- Throws:
Exception
-
testInitialCountFromL0
- Throws:
Exception
-
testSelectL0Compaction
- Throws:
Exception
-
testExistingStripesFromL0
- Throws:
Exception
-
testNothingToCompactFromL0
- Throws:
Exception
-
testCheckExpiredStripeCompaction
- Throws:
Exception
-
testSplitOffStripe
- Throws:
Exception
-
testSplitOffStripeOffPeak
- Throws:
Exception
-
testSplitOffStripeDropDeletes
- Throws:
Exception
-
testMergeExpiredFiles
- Throws:
Exception
-
testMergeExpiredStripes
- Throws:
Exception
-
createStripesWithFiles
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripesWithFiles(List<org.apache.hadoop.hbase.regionserver.HStoreFile>... stripeFiles) throws Exception - Throws:
Exception
-
testSingleStripeDropDeletes
- Throws:
Exception
-
testCheckExpiredL0Compaction
- Throws:
Exception
-
createPolicy
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy createPolicy(org.apache.hadoop.conf.Configuration conf) throws Exception HELPER METHODS- Throws:
Exception
-
createPolicy
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy createPolicy(org.apache.hadoop.conf.Configuration conf, long splitSize, float splitCount, int initialCount, boolean hasTtl) throws Exception - Throws:
Exception
-
al
-
verifyMergeCompatcion
private void verifyMergeCompatcion(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to) throws Exception - Throws:
Exception
-
verifyWholeStripesCompaction
private void verifyWholeStripesCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to, Boolean dropDeletes, Integer count, Long size, boolean needsCompaction) throws IOException Verify the compaction that includes several entire stripes.- Parameters:
policy- Policy to test.si- Stripe information pre-set with stripes to test.from- Starting stripe.to- Ending stripe (inclusive).dropDeletes- Whether to drop deletes from compaction range.count- Expected # of resulting stripes, null if not checked.size- Expected target stripe size, null if not checked.- Throws:
IOException
-
verifyWholeStripesCompaction
private void verifyWholeStripesCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int from, int to, Boolean dropDeletes, Integer count, Long size) throws IOException - Throws:
IOException
-
verifySingleStripeCompaction
private void verifySingleStripeCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int index, Boolean dropDeletes) throws IOException - Throws:
IOException
-
verifyNoCompaction
private void verifyNoCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si) throws IOException Verify no compaction is needed or selected.- Parameters:
policy- Policy to test.si- Stripe information pre-set with stripes to test.- Throws:
IOException
-
verifyCompaction
private void verifyCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, byte[] dropDeletesFrom, byte[] dropDeletesTo, List<byte[]> boundaries) throws Exception Verify arbitrary compaction.- Parameters:
policy- Policy to test.si- Stripe information pre-set with stripes to test.sfs- Files that should be compacted.dropDeletesFrom- Row from which to drop deletes.dropDeletesTo- Row to which to drop deletes.boundaries- Expected target stripe boundaries.- Throws:
Exception
-
verifyCompaction
private void verifyCompaction(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, Boolean dropDeletes, Integer count, Long size, byte[] start, byte[] end, boolean needsCompaction) throws IOException Verify arbitrary compaction.- Parameters:
policy- Policy to test.si- Stripe information pre-set with stripes to test.sfs- Files that should be compacted.dropDeletes- Whether to drop deletes from compaction range.count- Expected # of resulting stripes, null if not checked.size- Expected target stripe size, null if not checked.start- Left boundary of the compaction.end- Right boundary of the compaction.- Throws:
IOException
-
verifyFlush
protected void verifyFlush(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy policy, org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, org.apache.hadoop.hbase.KeyValue[] input, org.apache.hadoop.hbase.KeyValue[][] expected, byte[][] boundaries) throws IOException Verify arbitrary flush.- Throws:
IOException
-
dropDeletesMatcher
-
verifyCollectionsEqual
private void verifyCollectionsEqual(Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> sfs, Collection<org.apache.hadoop.hbase.regionserver.HStoreFile> scr) -
getAllFiles
private static List<org.apache.hadoop.hbase.regionserver.HStoreFile> getAllFiles(org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider si, int fromStripe, int toStripe) -
createStripes
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripes(int l0Count, byte[]... boundaries) throws Exception - Parameters:
l0Count- Number of L0 files.boundaries- Target boundaries.- Returns:
- Mock stripes.
- Throws:
Exception
-
createStripesL0Only
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripesL0Only(int l0Count, long l0Size) throws Exception - Parameters:
l0Count- Number of L0 files.l0Size- Size of each file.- Returns:
- Mock stripes.
- Throws:
Exception
-
createStripesWithSizes
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripesWithSizes(int l0Count, long l0Size, Long[]... sizes) throws Exception - Parameters:
l0Count- Number of L0 files.l0Size- Size of each file.sizes- Sizes of the files; each sub-array representing a stripe.- Returns:
- Mock stripes.
- Throws:
Exception
-
createStripesWithSizes
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripesWithSizes(int l0Count, long l0Size, List<List<Long>> sizes) throws Exception - Throws:
Exception
-
createBoundaries
-
createStripes
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripes(List<byte[]> boundaries, List<List<Long>> stripeSizes, List<Long> l0Sizes) throws Exception - Throws:
Exception
-
createStripesWithFiles
private static org.apache.hadoop.hbase.regionserver.compactions.StripeCompactionPolicy.StripeInformationProvider createStripesWithFiles(List<byte[]> boundaries, List<List<org.apache.hadoop.hbase.regionserver.HStoreFile>> stripeFiles, List<org.apache.hadoop.hbase.regionserver.HStoreFile> l0Files) throws Exception This method actually does all the work.- Throws:
Exception
-
createFile
private static org.apache.hadoop.hbase.regionserver.HStoreFile createFile(long size) throws Exception - Throws:
Exception
-
createFile
- Throws:
Exception
-
setFileStripe
private static void setFileStripe(org.apache.hadoop.hbase.regionserver.HStoreFile sf, byte[] startKey, byte[] endKey) -
createCompactor
private org.apache.hadoop.hbase.regionserver.compactions.StripeCompactor createCompactor() throws Exception- Throws:
Exception
-