@Test
  public void testRawScanWithoutKeepingDeletes() throws Exception {
    // KEEP_DELETED_CELLS is NOT enabled
    TableDescriptor htd = hbu.createTableDescriptor(TableName.valueOf(name.getMethodName()), 0, 3,
      HConstants.FOREVER, KeepDeletedCells.FALSE);
    HRegion region = hbu.createLocalHRegion(htd, null, null);

    long ts = EnvironmentEdgeManager.currentTime();
    Put p = new Put(T1, ts);
    p.addColumn(c0, c0, T1);
    region.put(p);

    Delete d = new Delete(T1, ts);
    d.addColumn(c0, c0, ts);
    region.delete(d);

    // scan still returns delete markers and deletes rows
    Scan s = new Scan();
    s.setRaw(true);
    s.readAllVersions();
    InternalScanner scan = region.getScanner(s);
    List<Cell> kvs = new ArrayList<>();
    scan.next(kvs);
    assertEquals(2, kvs.size());

    region.flush(true);
    region.compact(true);

    // after compaction they are gone
    // (note that this a test with a Store without
    // KEEP_DELETED_CELLS)
    s = new Scan();
    s.setRaw(true);
    s.readAllVersions();
    scan = region.getScanner(s);
    kvs = new ArrayList<>();
    scan.next(kvs);
    assertTrue(kvs.isEmpty());

    HBaseTestingUtil.closeRegionAndWAL(region);
  }
Even when the store does not keep deletes a "raw" scan will return everything it can find
(unless discarding cells is guaranteed to have no effect). Assuming this the desired behavior.
Could also disallow "raw" scanning if the store does not have KEEP_DELETED_CELLS enabled. (can
be changed easily)
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java