private int countDeleteMarkers(HRegion region) throws IOException {
    Scan s = new Scan();
    s.setRaw(true);
    // use max versions from the store(s)
    s.readVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
    InternalScanner scan = region.getScanner(s);
    List<Cell> kvs = new ArrayList<>();
    int res = 0;
    boolean hasMore;
    do {
      hasMore = scan.next(kvs);
      for (Cell kv : kvs) {
        if (CellUtil.isDelete(kv)) {
          res++;
        }
      }
      kvs.clear();
    } while (hasMore);
    scan.close();
    return res;
  }
Test keeping deleted rows together with min versions set
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java