HBASE-11439 StripeCompaction may not obey the OffPeak rule to compaction (Victor Xu)
This commit is contained in:
parent
ba044f010e
commit
5f3c0b7f9b
|
@ -266,7 +266,7 @@ public class StripeCompactionPolicy extends CompactionPolicy {
|
|||
int minFilesLocal = Math.max(
|
||||
allFilesOnly ? sfs.size() : 0, this.config.getStripeCompactMinFiles());
|
||||
int maxFilesLocal = Math.max(this.config.getStripeCompactMaxFiles(), minFilesLocal);
|
||||
return stripePolicy.applyCompactionPolicy(sfs, isOffpeak, false, minFilesLocal, maxFilesLocal);
|
||||
return stripePolicy.applyCompactionPolicy(sfs, false, isOffpeak, minFilesLocal, maxFilesLocal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -277,6 +277,22 @@ public class TestStripeCompactionPolicy {
|
|||
verifySingleStripeCompaction(specPolicy, si, 1, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSplitOffStripeOffPeak() throws Exception {
|
||||
// for HBASE-11439
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
conf.setInt(StripeStoreConfig.MIN_FILES_KEY, 2);
|
||||
// Select the last 2 files.
|
||||
StripeCompactionPolicy.StripeInformationProvider si =
|
||||
createStripesWithSizes(0, 0, new Long[] { defaultSplitSize - 2, 1L, 1L });
|
||||
assertEquals(2, createPolicy(conf).selectCompaction(si, al(), false).getRequest().getFiles()
|
||||
.size());
|
||||
// Make sure everything is eligible in offpeak.
|
||||
conf.setFloat("hbase.hstore.compaction.ratio.offpeak", 500f);
|
||||
assertEquals(3, createPolicy(conf).selectCompaction(si, al(), true).getRequest().getFiles()
|
||||
.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSplitOffStripeDropDeletes() throws Exception {
|
||||
Configuration conf = HBaseConfiguration.create();
|
||||
|
|
Loading…
Reference in New Issue