Example #1
1
 private void scrubCells(
     TransactionManager txManager,
     Multimap<String, Cell> tableNameToCells,
     long scrubTimestamp,
     Transaction.TransactionType transactionType) {
   for (Entry<String, Collection<Cell>> entry : tableNameToCells.asMap().entrySet()) {
     String tableName = entry.getKey();
     if (log.isInfoEnabled()) {
       log.info(
           "Attempting to immediately scrub "
               + entry.getValue().size()
               + " cells from table "
               + tableName);
     }
     for (List<Cell> cells : Iterables.partition(entry.getValue(), batchSizeSupplier.get())) {
       Multimap<Cell, Long> timestampsToDelete =
           HashMultimap.create(
               keyValueService.getAllTimestamps(
                   tableName, ImmutableSet.copyOf(cells), scrubTimestamp));
       for (Cell cell : ImmutableList.copyOf(timestampsToDelete.keySet())) {
         // Don't scrub garbage collection sentinels
         timestampsToDelete.remove(cell, Value.INVALID_VALUE_TIMESTAMP);
       }
       // If transactionType == TransactionType.AGGRESSIVE_HARD_DELETE this might
       // force other transactions to abort or retry
       deleteCellsAtTimestamps(txManager, tableName, timestampsToDelete, transactionType);
     }
     if (log.isInfoEnabled()) {
       log.info(
           "Immediately scrubbed " + entry.getValue().size() + " cells from table " + tableName);
     }
   }
 }