@Test
  public void testWithTTL() throws Exception {
    TableDescriptor htd = hbu.createTableDescriptor(TableName.valueOf(name.getMethodName()), 1,
      1000, 1, KeepDeletedCells.TTL);
    HRegion region = hbu.createLocalHRegion(htd, null, null);

    long ts = EnvironmentEdgeManager.currentTime() - 2000; // 2s in the past

    Put p = new Put(T1, ts);
    p.addColumn(c0, c0, T3);
    region.put(p);

    // place an old row, to make the family marker expires anyway
    p = new Put(T2, ts - 10);
    p.addColumn(c0, c0, T1);
    region.put(p);

    checkGet(region, T1, c0, c0, ts + 1, T3);
    // place a family delete marker
    Delete d = new Delete(T1, ts + 2);
    region.delete(d);

    checkGet(region, T1, c0, c0, ts + 1, T3);

    // 3 families, one column delete marker
    assertEquals(3, countDeleteMarkers(region));

    region.flush(true);
    // no delete marker removes by the flush
    assertEquals(3, countDeleteMarkers(region));

    // but the Put is gone
    checkGet(region, T1, c0, c0, ts + 1);

    region.compact(true);
    // all delete marker gone
    assertEquals(0, countDeleteMarkers(region));

    HBaseTestingUtil.closeRegionAndWAL(region);
  }
Test keeping deleted rows together with min versions set
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java