@Timed(name="bv.emodb.sor.AstyanaxDataWriterDAO.compact",absolute=true) @Override public void compact(Table tbl,String key,UUID compactionKey,Compaction compaction,UUID changeId,Delta delta,Collection<UUID> changesToDelete,List<History> historyList,WriteConsistency consistency){
  checkNotNull(tbl,"table");
  checkNotNull(key,"key");
  checkNotNull(compactionKey,"compactionKey");
  checkNotNull(compaction,"compaction");
  checkNotNull(changeId,"changeId");
  checkNotNull(delta,"delta");
  checkNotNull(changesToDelete,"changesToDelete");
  checkNotNull(consistency,"consistency");
  AstyanaxTable table=(AstyanaxTable)tbl;
  for (  AstyanaxStorage storage : table.getWriteStorage()) {
    DeltaPlacement placement=(DeltaPlacement)storage.getPlacement();
    CassandraKeyspace keyspace=placement.getKeyspace();
    ByteBuffer rowKey=storage.getRowKey(key);
    writeCompaction(rowKey,compactionKey,compaction,consistency,placement,keyspace,tbl,key);
    deleteCompactedDeltas(rowKey,consistency,placement,keyspace,changesToDelete,historyList,tbl,key);
  }
}

@ Timed ( name = "bv.emodb.sor.AstyanaxDataWriterDAO.compact" , absolute = true ) @ Override public void compact ( Table tbl , String key , UUID compactionKey , Compaction compaction , UUID changeId , Delta delta , Collection < UUID > changesToDelete , List < History > historyList , WriteConsistency consistency ) { checkNotNull ( tbl , "table" ) ; checkNotNull ( key , "key" ) ; checkNotNull ( compactionKey , "compactionKey" ) ; checkNotNull ( compaction , "compaction" ) ; checkNotNull ( changeId , "changeId" ) ; checkNotNull ( delta , "delta" ) ; checkNotNull ( changesToDelete , "changesToDelete" ) ; checkNotNull ( consistency , "consistency" ) ; AstyanaxTable table = ( AstyanaxTable ) tbl ; for ( AstyanaxStorage storage : table . getWriteStorage ( ) ) { DeltaPlacement placement = ( DeltaPlacement ) storage . getPlacement ( ) ; CassandraKeyspace keyspace = placement . getKeyspace ( ) ; ByteBuffer rowKey = storage . getRowKey ( key ) ; writeCompaction ( rowKey , compactionKey , compaction , consistency , placement , keyspace , tbl , key ) ; deleteCompactedDeltas ( rowKey , consistency , placement , keyspace , changesToDelete , historyList , tbl , key ) ; } }
we need to make sure that compaction is written * before * the compacted deltas are deleted . this should be a synchronous operation .
