HBASE-13473 deleted cells come back alive after the stripe compaction (jeongmin kim)

This commit is contained in:
tedyu 2015-04-16 11:36:25 -07:00
parent ddab4726f6
commit e08ef99e30
2 changed files with 12 additions and 1 deletions

View File

@ -248,7 +248,7 @@ public class StripeCompactionPolicy extends CompactionPolicy {
req = new SplitStripeCompactionRequest(
filesToCompact, si.getStartRow(bqIndex), si.getEndRow(bqIndex), targetCount, targetKvs);
}
if (canDropDeletesWithoutL0 || includeL0) {
if (hasAllFiles && (canDropDeletesWithoutL0 || includeL0)) {
req.setMajorRange(si.getStartRow(bqIndex), si.getEndRow(bqIndex));
}
req.getRequest().setOffPeak(isOffpeak);

View File

@ -40,6 +40,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
@ -424,6 +425,16 @@ public class TestStripeCompactionPolicy {
si = createStripesWithSizes(6, 2,
new Long[][] { new Long[] { 10L, 1L, 1L, 1L, 1L }, new Long[] { 12L } });
verifyCompaction(policy, si, si.getLevel0Files(), null, null, si.getStripeBoundaries());
// even if L0 has no file
// if all files of stripe aren't selected, delete must not be dropped.
stripes = new Long[][] { new Long[] { 100L, 3L, 2L, 2L, 2L }, new Long[] { 6L } };
si = createStripesWithSizes(0, 0, stripes);
List<StoreFile> compact_file = new ArrayList<StoreFile>();
Iterator<StoreFile> iter = si.getStripes().get(0).listIterator(1);
while (iter.hasNext()) {
compact_file.add(iter.next());
}
verifyCompaction(policy, si, compact_file, false, 1, null, si.getStartRow(0), si.getEndRow(0), true);
}
/********* HELPER METHODS ************/