use of org.apache.hadoop.hbase.client.Delete in project hbase by apache.
the class TestMinVersions method testDelete.
/**
* Make sure the Deletes behave as expected with minimum versions
*/
@Test
public void testDelete() throws Exception {
HTableDescriptor htd = hbu.createTableDescriptor(name.getMethodName(), 3, 1000, 1, KeepDeletedCells.FALSE);
Region region = hbu.createLocalHRegion(htd, null, null);
// 2s in the past
long ts = EnvironmentEdgeManager.currentTime() - 2000;
try {
Put p = new Put(T1, ts - 2);
p.addColumn(c0, c0, T1);
region.put(p);
p = new Put(T1, ts - 1);
p.addColumn(c0, c0, T2);
region.put(p);
p = new Put(T1, ts);
p.addColumn(c0, c0, T3);
region.put(p);
Delete d = new Delete(T1, ts - 1);
region.delete(d);
Get g = new Get(T1);
g.setMaxVersions();
// this'll use ScanWildcardColumnTracker
Result r = region.get(g);
checkResult(r, c0, T3);
g = new Get(T1);
g.setMaxVersions();
g.addColumn(c0, c0);
// this'll use ExplicitColumnTracker
r = region.get(g);
checkResult(r, c0, T3);
// now flush/compact
region.flush(true);
region.compact(true);
// try again
g = new Get(T1);
g.setMaxVersions();
// this'll use ScanWildcardColumnTracker
r = region.get(g);
checkResult(r, c0, T3);
g = new Get(T1);
g.setMaxVersions();
g.addColumn(c0, c0);
// this'll use ExplicitColumnTracker
r = region.get(g);
checkResult(r, c0, T3);
} finally {
HBaseTestingUtility.closeRegionAndWAL(region);
}
}
use of org.apache.hadoop.hbase.client.Delete in project hbase by apache.
the class TestMinorCompaction method testMinorCompactionWithDeleteVersion2.
@Test
public void testMinorCompactionWithDeleteVersion2() throws Exception {
Delete deleteVersion = new Delete(secondRowBytes);
deleteVersion.addColumn(fam2, col2, 1);
/*
* the table has 4 versions: 0, 1, 2, and 3.
* We delete 1.
* Should have 3 remaining.
*/
testMinorCompactionWithDelete(deleteVersion, 3);
}
use of org.apache.hadoop.hbase.client.Delete in project hbase by apache.
the class TestMinorCompaction method testMinorCompactionWithDeleteColumn2.
@Test
public void testMinorCompactionWithDeleteColumn2() throws Exception {
Delete dc = new Delete(secondRowBytes);
dc.addColumn(fam2, col2);
/* compactionThreshold is 3. The table has 4 versions: 0, 1, 2, and 3.
* we only delete the latest version. One might expect to see only
* versions 1 and 2. HBase differs, and gives us 0, 1 and 2.
* This is okay as well. Since there was no compaction done before the
* delete, version 0 seems to stay on.
*/
testMinorCompactionWithDelete(dc, 3);
}
use of org.apache.hadoop.hbase.client.Delete in project hbase by apache.
the class TestMinorCompaction method testMinorCompactionWithDeleteColumn1.
@Test
public void testMinorCompactionWithDeleteColumn1() throws Exception {
Delete dc = new Delete(secondRowBytes);
/* delete all timestamps in the column */
dc.addColumns(fam2, col2);
testMinorCompactionWithDelete(dc);
}
use of org.apache.hadoop.hbase.client.Delete in project hbase by apache.
the class TestMinorCompaction method testMinorCompactionWithDeleteVersion1.
@Test
public void testMinorCompactionWithDeleteVersion1() throws Exception {
Delete deleteVersion = new Delete(secondRowBytes);
deleteVersion.addColumns(fam2, col2, 2);
/* compactionThreshold is 3. The table has 4 versions: 0, 1, 2, and 3.
* We delete versions 0 ... 2. So, we still have one remaining.
*/
testMinorCompactionWithDelete(deleteVersion, 1);
}
Aggregations